He divorced his wife then married her again after another husband had divorced her; does he go back to having three talaaqs?
Question

A man divorced his wife (talaq) once, then after the end of the ‘iddah another man married her, and she remained with him for a while, then he divorced her. Now the first one wants to marry her again. Do there remain three new talaqs, or only two talaqs, seeing that he had divorced her previously?
Praise be to Allah.If a man divorces his wife with one or two talaqs, and her ‘iddah ends, then someone else marries her then divorces her, then the first husband marries her again, he does not have the right to more than the number of talaqs that remain. So if he had previously divorced her once, he only had two talaqs left, and if he had divorced her twice, he only has one talaq left.
It says in Zad al-Mustaqni‘: If a man had divorced his wife a number of times fewer than the total number of times that he is entitled to, then he takes her back or does is a new marriage contract with her [after the ‘iddah has ended], he does not have any more [than the number of talaqs] that were originally left, regardless of whether she married someone else in the meantime and the marriage was consummated with her or not. End quote.
What is meant by “a number of times fewer than the total number of times that he is entitled to” is: less than three talaqs. So if he had divorced her three times, then she married someone else, and he died or divorced her, then the first husband marries her again, in that case he regains the right to issue three talaqs, according to scholarly consensus.
Shaykh Ibn ‘Uthaymin (may Allah have mercy on him) said: There are three scenarios regarding this issue:
The first scenario: he divorces her, then takes her back. In this case he is only entitled to the number of talaqs that are left.
The second scenario: he divorces her, then her ‘iddah ends, then he marries her with a new marriage contract. In this case, he is only entitled to the number of talaqs that are left.
The third scenario: He divorces her, then her ‘iddah ends, then she marries someone else, then the second husband divorces her, then the first husband marries her again. In this case, he it is only entitled to the number of talaqs that are left.
What may be understood from the phrase “a number of times fewer than the total number of times that he is entitled to” is that if he had used up the number of talaqs to which he was entitled, which is three in the case of a free man and two in the case of a slave, then the woman would not become permissible for him except after marrying another husband. Then if he married her again after she had been married to someone else, in that case he would start all over again with regard to talaq and would be entitled to three talaqs, as if he had never married her until now. That is because marriage to the other husband, in this case, has an impact, which is that it makes her permissible for the first husband, and were it not for this marriage, she would not become permissible for the first husband. Because it has an impact, and the first husband had already used up the full number of talaqs to which he was entitled, she goes back to him with a clean slate terms of talaq, and it should not be said that if she goes back to him, he may only divorce her once, after which she becomes permanently forbidden to him, because we say that the second husband erased what the first husband did of talaqs, hence he made her permissible for him, at the time when she had become forbidden for the first one.
Some of the scholars are of the view that in the first scenario, if she marries a second husband, the second husband erases the talaqs, even if they were fewer than three. But the correct view is that favoured by the author, because marrying the second husband, if the first husband had not divorced her three times, has no impact, because she was still permissible for the first husband to remarry, whether she had married someone else or not."(Ash-Sharh al-Mumti‘  13/196).
The view that she may go back to him with the number of talaqs that are outstanding from the previous marriage was attributed by Ibn Qudaamah (may Allah have mercy on him) to senior Companions of the Messenger of Allah (blessings and peace of Allah be upon him): ‘Umar, ‘Ali, Ubayy, Mu‘aadh, ‘Imraan ibn Husayn and Abu Hurayrah. It was also narrated from Zayd and ‘Abdullah ibn ‘Amr ibn al-‘Aas. And it was the view of Sa‘eed ibn al-Musayyab, ‘Ubaydah, al-Hasan, Maalik, ath-Thawri, Ibn Abi Layla, ash-Shaafa‘i, Ishaaq, Abu ‘Ubaydah, Abu Thawr, Muhammad ibn al-Hasan and Ibn al-Mundhir.
The second view is the view of Ibn ‘Umar, Ibn ‘Abbas, ‘Ata’, an-Nakha‘i, Shurayh, Abu Hanifah and Abu Yusuf."(al-Mughni  7/389).
And Allah knows best.