All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
There is disagreement among jurists on whether fornication causes the prohibition of establishing a marriage relationship or not. The most preponderant opinion in our view is that it does not cause prohibition of marriage, since the unlawful cannot prohibit the lawful. So, based on this, it is not forbidden for a man to get married to a woman whom he has fornicated with her mother, and thus the marriage contract is not nullified by that.
However, we call your attention to the fact that the wife’s mother is from Al-Mahaarim (i.e. unmarriageable people) as Allah, The Almighty, says when He mentions the prohibited women to marry, {… your wives' mothers …} [Quran 4:23] As such, committing fornication with her is a major sin from which the person should make sincere repentance to Allah, the Exalted.
Besides, he should treat her as if she was a non-Mahram woman – a form of laying more restrictions on his relation with her – in case he doubts any desire towards her.
Allah knows the best.