He married a woman without her wali’s consent, then he divorced her three times, thinking that was essential before rectifying the marriage contract
Question

He got married with his wife without her father's consent but they made one of their friends as wali. After a while he got confused whether his marriage is valid or invalid. So he watched some videos and read articles of some scholars and realized that his marriage is invalid. And he thought if his marriage is invalid then he should divorce her(he misunderstood a fatwa that invalid marriage must be annuled by divorce) so he can get married again with her gurdian's approval. He called her and said " divorce three times because our marriage is invalid". He didn't know that in invalid marriage there is no divorce. He was totally ignorant about that.
Later on he found out that according to hanafi madhab his marriage is valid and he text his wife that "if my marriage is valid I am taking you back". Now my question is: are those divorces took place?
If he knew that his marriage is valid he would never say that word. His intention or condition of divorcing his wife was "if this marriage is invalid".
Praise be to Allah.Firstly:
Is it essential to divorce the wife in order to end an invalid marriage contract?
A marriage contract done without a wali (guardian) is undoubtedly an invalid marriage contract according to the majority of fuqaha’, with the exception of the Hanafis.
But if someone wants to end an invalid marriage, does he need to issue a divorce (talaaq)?
There is a difference of scholarly opinion about that. The view of the Hanbalis is that there must be a divorce, in contrast to the Shaafa‘is.
Ibn Qudaamah (may Allah have mercy on him) said: If a woman got married on the basis of an invalid marriage contract, it is not permissible to arrange a marriage for her to someone else until the first one divorces her or annuls his marriage to her. If he refuses to divorce her, the judge should annul the marriage. This was stated by Ahmad. Ash-Shaafa‘i said: There is no need for annulment or divorce, because the marriage contract was not done properly, so it is akin to marriage during the ‘iddah.
In our view, it is a type of marriage that is subject to different scholarly views, so there is a need to separate them, as in the case of a valid but controversial marriage, and because arranging another marriage for her before separating them will lead to two husbands having a claim over her, each of them believing that his marriage is valid and the marriage of the other is invalid.
If her marriage to another man is arranged before they are separated, then the second marriage is not valid either. End quote from al-Mughni (7/11).
This applies if the couple want to end the marriage.
But if they want to continue and rectify the marriage, they do not need to divorce; rather they need to renew the marriage contract only.
Secondly:
Does a divorce that is based on a wrong assumption or done for a wrong reason count as such?
If the husband divorced his wife because he mistakenly thought that he had to divorce her before rectifying the marriage contract, his divorce does not count as such according to the correct scholarly view.
Ibn al-Qayyim (may Allah have mercy on him) said: If a man says to his wife: You are thrice divorced because you spoke to Zayd and you went out of my house, then it turns out that she did not speak to him and she did not go out of his house, then she is not divorced and the divorce does not count as such…
What is meant is: if he gives the reason for the divorce, but then it becomes clear that the reason is not there, then according to the view of Ahmad, this divorce does not count as such. According to our shaykh, it is not necessary for him to mention the reason when uttering the words of divorce, and in his view it makes no difference whether he divorced her for a reason that he mentioned when uttering the words of divorce or he did not mention it. Once it becomes clear that the reason is not there, then there is no divorce.
This is the only appropriate view, and is in accordance with the guidelines of the four imams.
If it is said to him: Your wife drank with So and so, and spent the night with him, then he says: Bear witness that she is thrice divorced, then he finds out that on the night in question she was at home, praying qiyaam, then this divorce definitely does not count as such.
Saying that this counts as divorce is based on pure illusion, because he definitely never intended to divorce the one who was not like that; rather he intended to divorce the one who actually did that thing. End quote from I‘laam al-Muwaqqi‘een (4/90).
Shaykh Ibn ‘Uthaymeen said in ash-Sharh al-Mumti‘ (6/245):
If someone said something based on a reason that turned out to be non-existent, there is no ruling on his words.
This is a basic guideline to which many issues are connected, one of the most important of which is what happens to some people regarding divorce, when a man says to his wife, for example: If you enter the house of So-and-so, then you are divorced – based on his belief that that person has haraam musical instruments and the like, then it becomes clear that he has no such thing. If she enters that person’s house, is she divorced or not?
The answer is: she is not divorced, because that was based on a reason which turned out to be not true. This is the analogy, according to shar‘i rulings and real-life situations. End quote.
Based on that, the divorce mentioned does not count as such.
Therefore the marriage contract may be rectified in the presence of the woman’s wali (guardian) or his wakeel (proxy), with two Muslim witnesses.
And Allah knows best.