A well detailed explanation concerning this issue was given by Dr. Muzammil H. Siddiqi. He said:

“It is haram to engage in sex outside marriage. Those who commit such sin should repent and ask Allah’s forgiveness. It they both have repented and have stopped this sinful life, then they can marry each other.

One should not marry someone who is engaged in sinful life and does not leave his/her sinful behaviors.