Praise be to Allah.
if there was agreement between the two spouses, or between the husband and the woman’s guardian, that the marriage would be temporary and last for a set period of time, such as one or two years, or an unknown period of time, and that agreement was at the time of the contract or before it, then the marriage is invalid, because it is a mut‘ah (temporary) marriage, even if all the necessary conditions of marriage were fulfilled.
It says in al-Mughni (7/136): Mut‘ah marriage is not permissible – what is meant by mut‘ah marriage is that the man marries the woman for a particular length of time, such as if he says: I give you my daughter in marriage for a month, or a year, or until the Hajj ends, or until the pilgrim returns, and so on, whether the exact period is known or not. This is an invalid marriage, as was stated by Ahmad who said: Mut‘ah marriage is haraam.
This is the view of the majority of the Sahaabah and fuqaha’. Among those from whom it was narrated that it is haraam were: ‘Umar, ‘Ali, Ibn ‘Umar, Ibn Mas‘ood, and Ibn az-Zubayr. Ibn ‘Abd al-Barr said: Maalik, the people of Madinah, Abu Haneefah among the people of Iraq, al-Awzaa‘i among the people of Syria, al-Layth among the people of Egypt, and ash-Shaafa‘i were of the view that it is haraam. End quote.
Another example of mut‘ah marriage is doing the marriage contract with a woman on condition that he will divorce her when the stated period ends, whether it is known or unknown.
It says in Kashshaaf al-Qinaa‘ (5/97): Mut‘ah marriage is when a man marries a woman for a certain period, whether it is known or unknown, such as if the guardian says: I give you my daughter in marriage for a month, or for a year, or I give her to you in marriage until the Hajj season ends, or until the pilgrim returns, and so on, whether the period is known or otherwise.
If the husband stipulates in the marriage that he will divorce her at a certain time, even if it is unknown, then this is like mut‘ah, so it is not valid. End quote.
See: al-Mawsoo‘ah al-Fiqhiyyah (41/344)
Regardless of whether this condition is mentioned in the actual contract or not, so long as there was agreement to that, or this is customary in such marriages, then the ruling in all such cases is the same.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said, speaking about the invalidity of tahleel marriages:
… and whether that is stipulated in the marriage contract, or was stipulated before the marriage contract, or was not stipulated verbally, rather it was known from the context of the proposal, the situation of the man and the woman, and the mahr, which all may imply that it is a tahleel marriage.
End quote from Bayaan ad-Daleel ‘ala Batlaan at-Tahleel (6)
And he said:
The conditions that come before the marriage contract should be treated like conditions mentioned in the contract, if they are valid, and must be fulfilled. If they are invalid, they will affect the validity of the contract. End quote. (500)
See also al-Qawaa‘id an-Nooraaniyyah (302-303)
Guardianship with regard to marriage of a woman belongs, in order of precedence, to her father, then her grandfather, then her son, then her brother, then her paternal uncle, then the next closest, then the next closest. If she has no relatives, then the ruler may give her in marriage, because the Prophet (blessings and peace of Allah be upon him) said: “The ruler is the guardian of one who has no guardian.”
Narrated by Abu Dawood (2083); classed as saheeh by Shaykh al-Albaani.
If the qaadi (judge) gives her in marriage when there is someone who is a relative who is entitled to guardianship, then the marriage contract is not valid, because it is a transgression against their rights.
Ibn Qudaamah said in al-Mughni (7/22): If the more distantly-related guardian gives her in marriage, when there is a more closely-related guardian, and she agrees to his giving her in marriage without the permission of the more closely-related one, the marriage is not valid. This is the view of ash-Shaafa‘i. End quote.
Al-Hijaawi said in Zaad al-Mustaqni‘: If the more distant relative, or a non-relative, gives her in marriage with no good reason, it is not valid.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said in ash-Sharh al-Mumti‘ (12/45):
If the more distant relative, or a non-relative, gives her in marriage with no good reason, it is not valid. That is, when there is one who is more closely-related and is present, and is qualified to be her guardian. In that case the marriage is not valid, because the words of the Messenger (blessings and peace of Allah be upon him), “except with a guardian” refer to the position of guardianship, which implies that the one who is most entitled to it is the closest, then the next closest. End quote.
He (may Allah have mercy on him) was asked: A woman’s son did her marriage contract for her even though her father is still alive; what is the ruling on this marriage contract?
He replied: we should see which of them is more entitled to give the woman in marriage, her father or her son?
The answer is: her father is the one who should give her in marriage. If her son gives her in marriage when her father is still alive, if her father is far away and it is not possible to consult him, then there is nothing wrong with that, or if the father would prevent her from marrying this person with whom she is pleased, and he is compatible in terms of religious commitment and character, then there is nothing wrong with her son giving her in marriage. But if the father is present and would not refuse, then the marriage contract is not valid and must be repeated.
End quote from Liqa’ al-Baab al-Maftooh (no. 159).
Once it is established that the marriage is invalid, then the woman must leave immediately. Then if each of them wants to marry the other, the marriage contract must be repeated, fulfilling all the essential conditions of having a guardian and witnesses.
For more information on the conditions of marriage, please see the answer to question no. 2127.
The divorce that occurred is to be counted among the number of divorces, because he divorced her during a marriage that he believed was valid.
It says in Kashshaaf al-Qinaa‘ (5/237):
Divorce counts as such in a marriage concerning which there is a difference of opinion as to whether it is valid, such as marriage done under the guardianship of an evildoer, or marriage that was witnessed by two evildoers, or marriage to a sister during the ‘iddah of her sister who has been irrevocably divorced by the husband, or a shighaar (quid-pro-quo) marriage, or marriage of a muhallil, or the marriage done without witnesses or without a guardian and the like.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
With regard to a marriage concerning which there is a difference of opinion (as to its validity), it must be one of two things:
1. The one who got married thinks that it is valid; if he thinks that it is valid, then his divorce counts as such and there is no difference of opinion concerning that. For example, a man marries a woman who was breastfed three times by his mother, and he thinks that the number of times of breastfeeding that makes a person a mahram is five; in his view the marriage is valid, so any divorce issued by him undoubtedly counts as such.
Similarly, if he marries a woman without any witnesses, but he thinks that having witnesses present for the marriage contract is not a necessary condition. In this case too, his divorce counts as such
2. The one who gets married does not think that the marriage is valid. The scholars differed as to whether divorce in this case counts as such. Some of them said that it does count as such and others said that it does not. Those who said that it does not count as such said that is because divorce is connected to marriage, and he does not think that the marriage was valid, so his divorce does not count as such. This is a good argument and there is nothing wrong with it. Those who said that it does count as such said: that is because, even if he does not think that the marriage is valid, others may think that it is valid, so if he separates from her without divorce, and another person comes along who thinks that the marriage is valid, he will never marry her. So the divorce is valid in the case of a marriage concerning which there is a difference of opinion as to its validity, even if the one who issues the divorce does not think that it is valid, because if he did not divorce her, this woman would be in limbo.
If someone were to say: why does divorce count as such when he does not think that the marriage is valid, and divorce is connected to marriage? Our answer is: so that he will not prevent the woman from marrying someone else, because someone who thinks that the marriage is valid may want to marry her, so if that husband does not divorce her, no one else will ever marry her, as he will think that she is still married to him.
End quote from ash-Sharh al-Mumti‘ (13/ 24)
To sum up: you have to avoid this woman because the marriage is not valid. If each of you wants to stay with the other, then you must do a new marriage contract, meeting the necessary conditions, without divorcing her.
If there is no desire to do a new marriage contract, then you must divorce her once, so as to make her permissible for someone else, based on what is mentioned above.
And Allah knows best.