Praise be to Allah.
If a woman leaves her husband or a man leaves his wife for one or two years, or for more or less time than that, the marriage remains valid until the man actually divorces his wife. So long as that has not happened, and the man has not uttered the word of divorce (talaaq) to his wife, or has not written words to that effect with the intention of divorcing her, then the woman is still his wife, even if the separation has gone on for a long time.
Shaykh Ibn Baaz (may Allah have mercy on him) was asked: When is a woman regarded as divorced? He said: The woman is regarded as divorced if her husband issues a divorce (talaaq) to her when he is of sound mind and does so by choice, with no impediment to divorce such as insanity, intoxication and the like, and the woman is pure (i.e., not menstruating), during a period of purity in which he has not had intercourse with her, or she is pregnant or postmenopausal.
End quote from Fataawa at-Talaaq, 1/35
For more information, please see the answer to question no. 11681
Zina (fornication or adultery) is one of the major sins; the degree of sin is worse and the punishment is multiplied if the woman is married, because that is a betrayal of her husband … Hence the punishment for an unmarried zaani is one hundred lashes, and the punishment for a previously married zaani is stoning to death.
Allah, may He be exalted, says (interpretation of the meaning):
“And come not near to the unlawful sexual intercourse. Verily, it is a Fahishah (i.e. anything that transgresses its limits (a great sin)), and an evil way (that leads one to Hell unless Allah forgives him)”
Shaykh as-Sa‘di (may Allah have mercy on him) said: The prohibition on approaching it or coming near it is more eloquent than merely prohibiting the action, because that includes the prohibition on all the things that may lead to it or promote it, because the one who approaches a forbidden area will soon find himself wandering in it, especially in the case of this matter which is very tempting for many people.
Allah described zina and its abhorrent nature as a “faashishah” (something that transgresses its limits); in other words it is a sin that is regarded as immoral and odious in terms of sharee‘ah, rational thought and sound human nature, because it implies transgression of the sacred limits with regard to the rights of Allah, the rights of the woman and the rights of her family or husband, betrayal of marriage, confusion of lineage, and other negative consequences.
The words “and an evil way” mean: what an evil way is the way of the one who dares to commit this grave sin.
End quote from Tafseer al-Kareem ar-Rahmaan fi Tafseer Kalaam al-Mannaan, 1/457
What they must both do is repent sincerely, turn back to Allah and keep away from the things that lead to zina. Whoever repents, Allah will accept his repentance.
The basic principle is that it is not permissible for the zaani to marry the zaaniyah until after they have repented sincerely, because Allah, may He be exalted, says (interpretation of the meaning):
“The adulterer marries not but an adulteress or a Mushrikah and the adulteress none marries her except an adulterer or a Muskrik (and that means that the man who agrees to marry (have a sexual relation with) a Mushrikah (female polytheist, pagan or idolatress) or a prostitute, then surely he is either an adulterer, or a Mushrik (polytheist, pagan or idolater, etc.) And the woman who agrees to marry (have a sexual relation with) a Mushrik (polytheist, pagan or idolater) or an adulterer, then she is either a prostitute or a Mushrikah (female polytheist, pagan, or idolatress, etc.)). Such a thing is forbidden to the believers (of Islamic Monotheism)”
Repentance is attained by regretting (what one has done) and resolving not to go back to the sin. So long as they have repented and regretted what they fell into of sin, it is valid for them to marry according to most of the scholars.
Ibn Qudaamah (may Allah have mercy on him) said:
If a woman commits zina, it is not permissible for the one who knows of that to marry her unless two conditions are met:
1.That her ‘iddah has ended
2.That she has repented from zina.
If these two conditions are met, it is permissible for the zaani or anyone else to marry her, according to the opinion of most of the scholars, including Abu Bakr, ‘Umar, Ibn ‘Umar, Ibn ‘Abbaas, Jaabir, Sa‘eed ibn al-Musayyab, Tawoos, Jaabir ibn Zayd, ‘Ata’, al-Hasan, ‘Ikrimah, az-Zuhri, ath-Thawri, ash-Shaafa‘i, Ibn al-Mundhir, and ashaab ar-ra’y.
It was narrated from Ibn Mas‘ood, al-Bara’ ibn ‘Aazib and ‘Aa’ishah that she is not permissible (in marriage) for the zaani under any circumstances. They said: They are still zaanis whenever they are together, because of the general meaning of the verse and the report.
It may be that what they meant by that was the period before they repent or before it is established that she is not pregnant, in which case it is the same as our view.
With regard to it being forbidden in absolute terms, that is not correct, because Allah, may He be exalted, says (interpretation of the meaning): “All others are lawful, provided you seek (them in marriage) with Mahr (bridal money given by the husband to his wife at the time of marriage) from your property” [an-Nisa’ 4:24].
Because she is permissible (in marriage) for someone other than the one who committed zina with her, she is also permissible to him, like any other woman.
End quote from al-Mughni, 7/108.
It is not permissible for a Muslim to turn a woman against her husband because that leads to the breakup of families, even if there was a bitter dispute between the spouses. Some scholars regarded this as a major sin. The Prophet (blessings and peace of Allah be upon him) said: “He is not one of us who turns a woman against her husband.” Narrated by Abu Dawood, 2175; classed as saheeh by al-Albaani in Saheeh Abi Dawood.
Abu Dawood (5170) also narrated that Abu Hurayrah said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “Whoever turns a man’s wife or slave against him is not one of us.”
Classed as saheeh by al-Albaani in Saheeh Abi Dawood.
Shaykh ‘Abd al-‘Azeem Abaadi (may Allah have mercy on him) said:
“Whoever turns a woman against her husband” (means) by mentioning the husband’s bad qualities to his wife, or mentioning the good qualities of another man to her.
‘Awn al-Ma‘bood, 6/159
And he said “Whoever turns a man’s wife” means: he deceives her and corrupts her, or makes the idea of divorce attractive to her so that he or someone else can marry her, and so on.
‘Awn al-Ma‘bood, 14/52
Al-Mannaawi (may Allah have mercy on him) said: Our shaykh, ash-Sha‘raawi, said: That also includes the case where a woman who is angry with her husband comes to him so that he can reconcile between them, for example, so he offers her abundant food and wants to spend on her and honour her, even if that is in order to honour her husband, then her heart may be inclined to someone else and she starts to look down on her husband. This is also included in this hadeeth. The wise man should be careful with regard to such matters, even if his intention is good.
He said: I did this several times; I put pressure on the woman who was angry with her husband, and I advised my family to leave her hungry, so that she would go back and would appreciate how blessed she was with her husband.
End quote from Fayd al-Qadeer Sharh al-Jaami‘ al-Kabeer, 6/159
If a person turns a woman against her husband and spoils her for him so that she leaves him, then he marries her, his marriage is not valid and they must be separated, according to the view favoured by Shaykh al-Islam Ibn Taymiyyah (may Allah have mercy on him). This is also the view of the Maalikis. For more information on the ruling on this issue and what is meant by turning a woman against her husband, please see the answer to question no. 84849
Based on the above, if this man is the one who turned the woman against her husband, so that she would get divorced for his sake, it is not permissible for him to marry her, especially when he has committed zina with her. There is a difference of opinion concerning marriage of the zaani to the woman with whom he committed zina. In this case he has combined two evils: turning a woman against her husband and zina.
But if he is not the one who turned her against her husband, as appears to be the case from the question, and he only got to know her and meet her after she had left her husband and she had left his house, then his marriage to her is valid, if she has got divorced from her first husband, on condition that they both repent to Allah, may He be exalted, from what occurred between them.
And Allah knows best.