All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
Establishing such relationships between men and women is a cause for much evil and corruption, and what happened between you and that girl is clear evidence about this. It is for this reason that it is forbidden in Islam to have female friends; Allaah Says (what means): {…and not taking [secret] lovers.}[Quran 5:5]
Marriage is one of the rituals of Islam that has its foundations and conditions, among which are the guardian and the presence of two witnesses. As regards a young man having sexual intercourse with a young woman as if they are married, then this is playing with religion. How dare you do that while you know that it is forbidden?
In any case, you did well by coming back to righteousness and you are obliged to be careful not to mix with girls or be in seclusion with them, and you should avoid anything that may lead you to temptation again.
Moreover, you should look for a pious woman to marry and if this is facilitated for you, then praise be to Allaah, otherwise you should do anything that may help you keep yourself chaste, like fasting, keeping company with righteous people and occupying yourself with what benefits you in your religion and in your worldly matters.
Furthermore, you are obliged to repent from all sins, whether it is Zina (fornication or adultery) or any other sin; Allaah Says (what means): {And turn to Allaah in repentance, all of you, O believers that you might succeed.}[Quran 24:31] Allaah also Says about the characteristics of the Slaves of the Most Merciful (what means): {…and do not commit unlawful sexual intercourse. And whoever should do that will meet a penalty. Multiplied for him is the punishment on the Day of Resurrection, and he will abide therein humiliated. Except for those who repent.}[Quran 25:68-70] For more benefit on the conditions of repentance, please refer to Fataawa 87903 and 86527.
It is not an obligation for a man and a woman who committed Zina to marry each other, let alone to marry immediately. Rather, if he wants to marry her, he should first make sure that she is not pregnant as clarified in Fatwa 83176 and 81160.
Indeed, that girl has got the sin of committing Zina with you and she is also sinful by establishing a relationship with another young man. No doubt, she is more sinful in this regard.
Finally, marrying a woman who committed Zina is lawful only with the following two conditions: her repentance and making sure that she is not sinful; we have already clarified this in the first two Fataawa we referred you to. Therefore, if this girl continues to commit Zina, it is not lawful for you or the other young man to marry her and she is not obliged to marry the person with whom she committed Zina as we have already clarified.
Allaah Knows best.