Apostasy of both spouses from Islam and the impact of that on their marriage contract
Question

                I have been married nearly three years, I was pregnant before I was married but did not know, with my husbands child, we was together before being Muslims as well. I was strong in emaan while he was not mostly and then my own emaan deteriorated from everything. He drank he smoked weed, made harram money and went partying. He didnt give me my rights, he had even been physical with me while I was fasting. He commited zina through out our whole marriage non stop. I continued to stay with him which I know was bad udhuu billah but anyway my emaan weakened because of this and we both come off deen and left each other, stopped praying etc everything and both saw other people. We got back together within a three month period even though there was no divorce. We got back on deen, well we tried at the time. He was still fornicating with this girl and that and now he is in jail he has been in jail for 6 months and I have been rebuilding my emaan alhamdulilah and would like to remarry. So is my marriage valid and would I need to seek a khuluq? Also I never received dowry. Im sorry for the longness of this but I did not want to miss out anything inshallah
Praise be to Allah.
	Firstly:

	We praise Allah, may He be exalted, for having guided you and 
	enabled you to repent and come back to Islam once more, and we ask Him to 
	make us and you steadfast until death.

	Secondly:

	If both spouses apostatise after consummation of the 
	marriage, separation between them depends on whether the ‘iddah ends without 
	them coming back to Islam. If they both come back to Islam before the end of 
	the ‘iddah, then their marriage contract remains valid, but if their return 
	to Islam is delayed, or the return of one of them to Islam is delayed, until 
	the ‘iddah comes to an end, then their marriage is annulled according to the 
	majority of fuqaha’.

	Ash-Shiraazi ash-Shaafa‘i said in his book at-Tanbeeh 
	(165): If two Muslim spouses apostatise, or one of them apostatises, before 
	consummation of the marriage, then they have to be separated immediately.

	If that happens after consummation of the marriage, then 
	separation depends on whether the ‘iddah has come to an end. If they both 
	come back to Islam before the end of the ‘iddah, then their marriage 
	contract remains valid, but if they do not come back to Islam before the end 
	of the ‘iddah, then they are to be separated. End quote.

	Ibn Qudaamah (may Allah have mercy on him) said in al-Mughni 
	(7/174): If both spouses apostatise together, then the ruling on both is the 
	same as the ruling if only one of them had apostatised. If that happens 
	before consummation of the marriage, then they have to be separated 
	immediately, but if it happened after that, do they have to be separated 
	immediately or does it depend on whether the ‘iddah has ended?  There are 
	two views. This is the view of ash-Shaafa‘i. Ahmad said, according to the 
	report of Ibn Mansoor: If both of them, or one of them, apostatised, then 
	repented, then he has more right to keep her, so long as the ‘iddah has not 
	ended. End quote.

	Some of the scholars think that if the ‘iddah has ended and 
	they have not yet come back to Islam, or one of them has not yet come back, 
	then their marriage contract remains in effect if the wife agrees to that 
	and has not married someone else.

	See: Fataawa Arkaan al-Islam by Shaykh Ibn ‘Uthaymeen 
	(p. 29), and the answer to question no. 21690.

	The ‘iddah of a pregnant woman lasts until she gives birth. 
	The ‘iddah of one who is not pregnant lasts for three menstrual cycles if 
	she menstruates. The ‘iddah of a post-menopausal woman is three months.

	Thirdly:

	You stated that you got back together after less than three 
	months. If you got back together at the same time as coming back to Islam, 
	then your marriage contract remains valid, if you came back to Islam before 
	the end of the ‘iddah.

	So if your husband is now in jail and you want to separate 
	from him, you have no choice but to ask for talaaq (divorce) or khul‘.

	It is not permissible to ask for that except for a valid 
	shar‘i reason, such as if the husband is persisting in evil deeds such as 
	zina (fornication) or drinking alcohol, or if the wife dislikes him and 
	cannot bear to stay with him.

	Khul‘ involves the woman giving up her mahr, or part of it, 
	or giving her husband money, according to what they agree upon.

	As you have not taken your mahr from him, khul‘ may be done 
	by waiving your right to this mahr or part of it. Once the talaaq or khul‘ 
	is concluded, then you must observe ‘iddah from the time when the talaaq or 
	khul‘ was concluded. Then after your ‘iddah is over, you may marry whomever 
	you want. The iddah of a woman who is divorced by talaaq is what has been 
	explained above: if she is pregnant then it is until she gives birth, and if 
	she menstruates then it is three menstrual cycles. In the case of khul‘ the 
	‘iddah is one menstrual cycle, but if she is pregnant, then it is until she 
	gives birth.

	See also fatwa no. 14569.

	If you got back together without coming back to Islam, or if 
	either you or your husband delayed returning to Islam until the ‘iddah had 
	ended, then the marriage contract is annulled according to the majority of 
	fuqaha’.

	We stated above that there are some scholars who say that the 
	couple’s marriage contract remains valid, if the wife agrees to that.

	What appears to be the case from your question is that you do 
	not want to stay with this man. As that is the case, we say: if the ‘iddah 
	ended before you both came back to Islam, or before he came back to Islam, 
	then your marriage contract has been annulled, and it is permissible for you 
	to marry someone else.

	In that case:

	If you had one menstrual cycle after the last time you were 
	together, then you do not need to establish that you are not pregnant (by 
	waiting for another menstrual cycle). If that is not the case, then you 
	should not marry anyone else until you have established that you are not 
	pregnant, by waiting for one menstrual cycle, because of the general meaning 
	of the words of the Prophet (blessings and peace of Allah be upon him) 
	concerning the female captives of Awtaas: “No one should have intercourse 
	with a pregnant woman until she has given birth, or with one who is not 
	pregnant until one menstrual cycle has passed.” Narrated by Abu Dawood 
	(2157) and at-Tirmidhi (1564); classed as saheeh by al-Albaani in Saheeh 
	Abi Dawood.

	And Allah knows best.