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.
If the ruling of your divorce was issued by an Islamic court and you remarried after your waiting period had expired, then your marriage is valid.
However, the fact that your first husband was mistreating you is not a sound reason for establishing an illicit relationship with your relative; you should have had divorced your husband if you were not able to rectify him and then you might have married another man. As regards establishing such an illicit relationship, then thi is a great sin.
Hence, we advise you to repent to Allaah, seek His Forgiveness and perform as much good deeds as possible. Allaah Says (what means): {But whoever repents after his wrongdoing and reforms, indeed, Allaah will turn to him in forgiveness. Indeed, Allaah is Forgiving and Merciful.} [Quran 5:39]
Allaah also Says (what means): {But indeed, I am the Perpetual Forgiver of whoever repents and believes and does righteousness and then continues in guidance.} [Quran 20:82]
Taking divorce from your second husband (your relative) does not expiate your sins; rather, the expiation of your sins -as we have mentioned -is only by repentance. Therefore, it is not permissible for you to ask for divorce from this second husband unless there is a sound reason, like if he is dissolute and correcting him is impossible. However, it is not permissible for you to ask for divorce without a sound reason.
The Prophet said: “Any woman who asks her husband to divorce her, without a religiously accepted reason, the smell of Paradise is forbidden for her.” [Ahmad]
Therefore, you should go back to live with him and try your best to be obedient to Allaah and to encourage your husband to do so.
Finally, it should be noted that if the ruling of divorce was not issued by an Islamic court, then it is a void ruling; in which case, you are still considered the wife of the first husband. So, you should separate from this second man and observe a waiting period of three menses.
We ask Allaah to enable both of you to do whatever He likes and whatever pleases Him.
Allaah Knows best.