We ask Allah to accept your repentance and set your affairs straight, and help you to maintain your religious commitment.
You made a mistake by moving away from your husband and exposing yourself to trials and tests, and your husband made a mistake by not allowing you to work whilst not sending you any maintenance to spare you from having to work.
If your husband had divorced you twice, as you say, then your ‘iddah ended before the second marriage, then you do not have to do anything and your second marriage is valid in that case.
The ‘iddah of a woman who menstruates is three menstrual cycles. If he divorced you when you were in a state of purity (i.e., not menstruating) then you had three menstrual periods, when you became pure following the third period and did ghusl, your ‘iddah came to an end.
The ‘iddah of a woman who does not menstruate because she is too young or has passed menopause is three months.
The ‘iddah of a woman who is pregnant ends when her pregnancy ends.
If the divorce was in return for payment from the woman, then this is khul‘, in which case the ‘iddah is one menstrual cycle, according to the more correct opinion.
If the second marriage contract was not done until after your ‘iddah ended, then it is a valid marriage and you do not have to do anything, but it is not permissible for you to go back to the first husband unless the second husband divorces you and the ‘iddah following that divorce comes to an end. Then the first husband can do a marriage contract with you.
But if your second marriage was done during the ‘iddah, then it is an invalid marriage and does not count, and you have committed a grave and serious evil by doing that.
Ibn Qudaamah said: With regard to invalid marriages, such as marriage to a woman who is married or still in the ‘iddah period, and the like, if they were aware of what is halaal and haraam in this regard then they have committed zina and are subject to the hadd punishment, and any child born as a result cannot be attributed to the man.
End quote from al-Mughni, 7/10
And he said: If he marries a woman who is still in the ‘iddah period and they both knew about the ‘iddah and that marriage is forbidden during that period, and he had intercourse with her, then they have committed zina and are subject to the hadd punishment for zina, she is not entitled to any mahr, and any child born as a result cannot be attributed to the man.
If they were both unaware of the ‘iddah and the prohibition (on marriage at that time), then any child born as a result is to be attributed to the man and no hadd punishment is to be carried out, and she is entitled to the mahr.
If he was aware of that but she was not, then he is subject to the hadd punishment and must pay the mahr, and any child born as a result is not to be attributed to him.
If she was aware of that but he was not, then she is subject to the hadd punishment and is not entitled to any mahr (dowry), and any child born as a result is to be attributed to the man.
That is the case because this is a marriage concerning which there is consensus that it is invalid; it is akin to incest.
End quote from al-Mughni, 8/103
In that case the second marriage is annulled because it is invalid, and you have to complete the ‘iddah from the first marriage, then observe ‘iddah from the second marriage. Then can you go back to your first husband or not?
- If he had taken you back during the ‘iddah – even if that was without your knowledge – or he took you back during the completion of the ‘iddah for his divorce, then you are still his wife.
- If the ‘iddah ended without him taking you back, then he is a stranger (non-mahram) to you and you cannot go back to him except with a new marriage contract. In that case you have the choice between marrying him or the second one or someone else.
The point is that marrying another man during the ‘iddah is invalid, whether the first one took you back during the ‘iddah or not, and whether you will go back to him with a new marriage contract or not.
And Allah knows best.