Praise be to Allah.
It is not permissible for anyone to issue a fatwa concerning the religion of Allah without knowledge. Whoever does that has committed a major sin. Allah says (interpretation of the meaning):
“Say (O Muhammad): (But) the things that my Lord has indeed forbidden are Al‑Fawaahish (great evil sins and every kind of unlawful sexual intercourse) whether committed openly or secretly, sins (of all kinds), unrighteous oppression, joining partners (in worship) with Allah for which He has given no authority, and saying things about Allah of which you have no knowledge” [al-A’raaf 7:33].
The one who gave you a fatwa stating that your taking back your wife after the second divorce was not valid, and that the third divorce did not count and that you had to do the marriage contract in order to take your wife back, was not correct in what he said. This comes under the heading of speaking about Allah without knowledge. The one who gave you this fatwa -- if you have quoted it correctly -- has to repent to Allah and seek His forgiveness, and he has to refrain from giving fatwas, especially those which have to do with honour and bloodshed.
Revocable divorce is that in which the husband has the right to take the wife back, without a new marriage contract, dowry or consent of the wife. The divorce in which the husband has the right to take the wife back is the first or second divorce, before the ‘iddah ends. But if the ‘iddah of a first or second divorce ends, it becomes irrevocable in a minor sense, and she cannot go back to her husband unless she agrees and there is a new marriage contract and a new dowry. There is no difference of opinion concerning this among the scholars, and the evidence for it is the verse in which Allah says (interpretation of the meaning): “The divorce is twice, after that, either you retain her on reasonable terms or release her with kindness” [al-Baqarah 2:229]. If a third divorce takes place, she is not permissible for him except after she marries another husband in a genuine marriage, then he divorces her or dies after consummating the marriage with her -- and this is the irrevocable divorce in the major sense. The evidence for that is the following verse in which Allah says (interpretation of the meaning): “And if he has divorced her (the third time), then she is not lawful unto him thereafter until she has married another husband. Then, if the other husband divorces her, it is no sin on both of them that they reunite, provided they feel that they can keep the limits ordained by Allah. These are the limits of Allah, which He makes plain for the people who have knowledge” [al-Baqarah 2: 230].
If we think positively of the person who said that, and assume that he thinks that a thrice-uttered divorce counts as three, then there is no validity in his saying that it is irrevocable divorce in the minor sense, because the thrice-uttered divorce, according to those who say that it counts as three, means that the wife is irrevocable divorced in the major sense. So how can it be permissible for him to say that it is irrevocable divorce in the minor sense and that she may go back to him with a new marriage contract and a new dowry?
The correct view is that the thrice-uttered divorce counts as one divorce. We have explained that in the answer to question number 96194. It was narrated from Ibn ‘Abbaas (may Allah be pleased with him) that he 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. Narrated by Muslim (1472).
what happened in your case, namely your taking back your wife after the first and second divorce is valid, but by virtue of the third divorce, the wife has become haraam to you and is irrevocably divorced in the major sense; she is a stranger to you and you have to give her her rights in full, and it is not permissible for you to marry her until after she has married another man in a genuine marriage and he leaves her by death or divorce, after consummating the marriage with her.
With regard to nikaah al-tahleel [a sham marriage aimed at making it permissible for the wife to go back to her first husband] which some people do, it is an invalid marriage which does not make it permissible for the woman to go back to her first husband. The Prophet (blessings and peace of Allah be upon him) cursed those who do that.
See the answer to question number 109245.
And Allah knows best.