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.
First of all, this woman is obliged to take the initiative to repent from committing Zina (fornication or adultery) as this is a grave major sin; this sin is even greater as she is a married woman. For more benefit, please refer to Fatwa 86527.
Usually, it is being lenient in dealing with a non-Mahram man that leads to committing such a sin, so one should be careful about this. Besides, it is not permissible for a woman to allow a non-Mahram man to enter upon her or be in seclusion with her if there is no male Mahram with her, and the like.
Similarly, it a sin for a wife to ask her husband for divorce without a sound reason. However, if this woman was divorced from her first husband and her waiting period from him expired, then she married the second husband after they both had repented to Allaah, then the marriage is valid.
The fact that she had committed Zina with him while she was still married to the first husband does not make this second marriage void. For more benefit, please refer to Fatwa 86731.
On the other hand, if that man had caused the spoiling of her marital relationship with her husband and he was the reason for her divorce from him, then he is sinful.
Indeed, some jurists are of the view that the marriage of a man with the woman for whom he was the cause of spoiling the marital relationship with her husband is void, but the majority of the scholars are of the view that this marriage is valid. For more benefit, please refer to Fatwa 92056.
To conclude, the marriage of this woman according to the situation that you mentioned in the question is valid if they both had repented before the marriage contract. If they had not repented before the marriage, then there is a difference of opinion on its validity, but the majority of the scholars are of the view that this marriage is valid.
Allaah Knows best.