Question
If a couple who have been guilty of zina marry before they repent, is the marriage legally valid even though Allah says in surah nur verse 3 that such a thing is haram on the believers. If so, how does the validity of this marriage differ from other haram marriages such as marrying a fifth wive or two sisters at the same time etc.
Answer
If you read Surah Al-Noor 24:3 closely, it states that only those who have had sex out of wedlock (i.e. zina) are allowed to marry one another.
With the proper understanding of the verse, the conclusion is that lechers and promiscuous women are to only marry each other or idolators. Thus, the marriage of the couple who have not repented is legally valid even though they have sinned as described. Their repentance is a matter between them and God, whether they have properly done so is for Him to decide.
As to the second part of your question, the matter should be understood that the actual act of marriage to those mentioned is sinful itself. This is different from two fornicators getting married because their sin comes from premarital sex and not the marriage itself. So in the first case the sins were already committed pre-marriage, while in the second case the sin only occurs because the marriage takes place between two people that are prohibited from being married. Besides, in the first instance the only prohibition is that a chaste person cannot marry a fornicator, not that marriage is not allowed to fornicators. On the other hand in the second example, the marriage is categorically not supposed to take place.
Here is an illustration:
Group A – Those who have had sex out of wedlock.
Group B – Those who marry people they are not supposed to marry.
Group A committed their sin, which is fornication, but they can marry each other. Their marriage to each other is not a sin; however, chaste believers are not allowed to marry them.
Group B commit their sin only when they marry those that they are not supposed to marry. In this case, the marriage itself is the sin.
I hope this helps.
God knows best.