Praise be to Allah.
The one who has committed zina (fornication or adultery) has to repent, because zina is one of the major sins which are forbidden in Islam and for which a stern warning is issued to the one who does them. Allaah says (interpretation of the meaning):
“And those who invoke not any other ilaah (god) along with Allaah, nor kill such person as Allaah has forbidden, except for just cause, nor commit illegal sexual intercourse and whoever does this shall receive the punishment.
The torment will be doubled to him on the Day of Resurrection, and he will abide therein in disgrace”
The punishment must be carried out in this world on the one who has committed zina (fornication or adultery), as Allaah says (interpretation of the meaning):
“The fornicatress and the fornicator, flog each of them with a hundred stripes. Let not pity withhold you in their case, in a punishment prescribed by Allaah, if you believe in Allaah and the Last Day. And let a party of the believers witness their punishment”
It was narrated in a hadeeth from the Prophet (peace and blessings of Allaah be upon him): “Receive (teaching) from me, receive (teaching) from me. Allaah has ordained a way for those (women). When an unmarried male commits adultery with an unmarried female, (they should receive) one hundred lashes and banishment for one year. And in the case of a married male committing adultery with a married female, they shall receive one hundred lashes and be stoned to death.”
(Narrated by Muslim, al-Hudood, 3199).
Allaah has forbidden the believers to marry a person who commits zina, whether man or woman. Allaah says (interpretation of the meaning):
“The adulterer — fornicator marries not but an adulteress — fornicatress or a Mushrikah; and the adulteress –fornicatress, none marries her except an adulterer — fornicater or a Mushrik [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 — fornicator, or a Mushrik (polytheist, pagan or idolater). And the woman who agrees to marry (have a sexual relation with) a Mushrik (polytheist, pagan or idolater) or an adulterer — fornicator, then she is either a prostitute or a Mushrikah (female polytheist, pagan, or idolatress)]. Such a thing is forbidden to the believers (of Islamic Monotheism)”
If the one who has committed zina repents to Allaah, truly and sincerely, then Allaah will forgive him or her, and overlook the sin. Allaah says, after mentioning the warning to those who commit zina:
“Except those who repent and believe (in Islamic Monotheism), and do righteous deeds; for those, Allaah will change their sins into good deeds, and Allaah is Oft Forgiving, Most Merciful.
And whosoever repents and does righteous good deeds; then verily, he repents towards Allaah with true repentance”
[al-Furqaan 25:70-71 – interpretation of the meaning]
If the person repents sincerely, then it becomes permissible for him or her to get married, after they give up this sin.
Shaykh Muhammad ibn Ibraaheem was asked about the ruling on getting married to a woman who has committed zina. He said: “it is not permissible to marry the woman who has committed adultery until she repents… if a man wants to marry her, he has to be sure that she is not pregnant, by waiting until she has a period before he does the marriage contract with her. If she is pregnant, then it is not permissible for him to marry her until she has given birth.”
See al-Fataawa al-Jaami’ah li’l-Mar’ah al-Muslimah, 2/584