Both must first repent sincerely, since Allah says the fornicator marries none but a fornicatress or a mushrikah, "and that has been made unlawful to the believers" — and Allah promises that whoever repents, believes and does righteous work, He will replace their evil deeds with good ones. Alongside repentance the Mālikīs and Ḥanbalīs require istibrāʾ — that her womb be confirmed empty by one menstrual cycle, or by delivery if she is pregnant — so that lineage is not confused, following the Prophet's ﷺ words, "There must be no intercourse with a pregnant woman until she gives birth, nor with one not pregnant until she has had one menstrual period." The Ḥanafīs and Shāfiʿīs hold the contract itself valid though blameworthy, the Ḥanafīs adding that there may be no intimacy until she delivers. The safest and strongest position, and the fatwa of the Permanent Committee and Ibn Bāz, is that neither he nor anyone else marries her until she has repented and given birth or completed a cycle. A child born of zinā is attributed to the mother, not to the man, and the past sin — once repented from sincerely and concealed — should never be broadcast.
Q&A · Marriage & Divorce
Can a man marry a woman he committed zinā with, or a woman pregnant from zinā?
Evidence — the daleel
On deen2u
Informational, not a personal fatwa. Consult a qualified scholar for rulings on your situation.