He divorced her once, then she came back, and he divorced her twice during the ‘iddah
Question

The husband of one of my friends divorced her via sms [text message], issuing one talaaq, then after that one of her relatives got in touch with him to ask him what the problem was, and he got even more angry, and said, “She is divorced a second and third time.” Please note that he did all of that when he was in his right mind. After that, he got in touch and said, “I want to take her back,” but he was told that there was no longer any chance, because he had already divorced her three times. Now the need for them to get back together has become more urgent, because when he divorced her, she was approximately seven months pregnant, and she has given birth now. What is the ruling? Do these three talaaqs count as only one talaaq? Is there any possible way that they can get back together?
Praise be to Allah.The fuqaha’ differed regarding one who issues two or three talaaqs together. The view that is most likely to be correct is that it counts as one divorce (talaaq), regardless of whether he utters them in one phrase, such as saying, “You are thrice divorced”; or he says them separately, such as saying, “You are divorced, you are divorced, you are divorced”; or he says as in the question, “She is divorced a second and third time.”  This is the view favoured by Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him), and it was regarded as more likely to be correct by Shaykh as-Sa‘di (may Allah have mercy on him) and Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him).
They quoted as evidence the report narrated by Muslim (1472) from Ibn ‘Abbaas (may Allah be pleased with him), who said: At the time of the Messenger of Allah (blessings and peace of Allah be upon him), Abu Bakr and the first two years of ‘Umar’s caliphate, a threefold divorce was counted as one. Then ‘Umar ibn al-Khattaab said: People have become hasty in a matter in which they should take their time. I am thinking of holding them to it. So he made it binding upon them.
These scholars (may Allah have mercy on them) favoured the view that divorce does not count as such except after taking the wife back or doing a new marriage contract with her. So if someone divorces his wife one day, then divorces her again during the ‘iddah following the first talaaq, the second talaaq does not count as such.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said: The view that is most likely to be correct regarding all these matters is that there is no threefold talaaq at all, unless the man divorces his wife, then takes her back (before her ‘iddah ends), then divorces her again, in which case the second divorce counts as such, or he divorces her and her ‘iddah ends, then he does a new marriage contract with her, then he divorces her again – and so on until he has divorced her three times; otherwise it does not count as three. This is the view favoured by Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him), and it is the correct view." (Ash-Sharh al-Mumti‘ 13/94).
Based on that, so long as the husband uttered the word of the second and third divorce during the ‘iddah following the first talaaq in which he had not taken back his wife, then only the first talaaq counts as such, and he may take his wife back so long as the ‘iddah has not yet ended. As her ‘iddah ended when she gave birth, he may do a new marriage contract with her, with a mahr, guardian and witnesses, but the previous divorce still counts [as the first of three].
And Allah knows best.