Praise be to Allah.
If the husband does or says something that implies apostasy from Islam, such as reviling Allah (may He be exalted) or reviling His Messenger (blessings and peace of Allah be upon him) or denying something that is well known to be a basic matter of Islam -- if that happens before consummating the marriage, then the marriage is annulled straight away.
Ibn Qudaamah (may Allah have mercy on him) said: If one of the spouses apostatises before consummation of the marriage, the marriage is annulled according to most scholars. But it was narrated from Dawood that (marriage) is not annulled by apostasy, because the basic principle is that the marriage remains as it is. But Allah says (interpretation of the meaning): “Likewise hold not the disbelieving women as wives” [al-Mumtahanah 60:10] and “send them [believing women] not back to the disbelievers. They are not lawful (wives) for the disbelievers nor are the disbelievers lawful (husbands) for them” [al-Mumtahanah 60:10]. The difference in religion means that intimacy is not permissible, which inevitably means annulling the marriage, as is also the case if a woman becomes Muslim whilst married to a kaafir.
End quote from al-Mughni, 7/133
It apostasy occurs after consummation, should they be separated immediately or should separation be delayed until the end of the ‘iddah?
There is a difference of opinion among the fuqaha’ concerning this.
The view of the Shafaa‘is, and the correct view according to the Hanbalis, is that if he comes back to Islam before his wife’s ‘iddah ends, then the marriage remains as is. If the ‘iddah ends before he comes back to Islam, then separation takes place and he cannot go back to his wife except with a new marriage contract.
The view of the Hanafis and Maalikis is that apostasy means that they must be separated immediately, even if that is after consummation of the marriage. See: al-Mughni, 7/133; al-Mawsoo‘ah al-Fiqhiyyah, 22/198; al-Insaaf, 8/216; Kashshaaf al-Qinaa‘, 5/121; Tuhfat al-Muhtaaj, 7/328; al-Fataawa al-Hindiyyah, 1/339; Haashiyat al-Dasooqi, 2/270.
Some of the scholars say that if he repents after the ‘iddah ends, he may go back to his wife if she agrees to that and she has not married someone else.
See: Fataawa Arkaan al-Islam by Shaykh Ibn ‘Uthaymeen, p. 279, as well as the answer to question no. 21690.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said: To sum up, one of three scenarios must apply in the case of the husband who gives up prayer:
(i)If that happens before the marriage contract is done, the marriage is not valid and the wife does not become permissible thereby.
(ii)If that happens after the marriage contract is done and before the marriage is consummated or the couple spends time alone together, which would make the ‘iddah obligatory, the marriage is annulled as soon as he gives up prayer.
(iii)If that happens after the marriage was consummated or the couple spent time alone together, which would make the ‘iddah obligatory, it depends on whether the ‘iddah has ended or not. If he repents and begins to pray before the end of the ‘iddah, then she is still his wife, but if he does not do that, then when the ‘iddah ends, the marriage is annulled from the time he apostatised -- Allah forbid. In that case, if he comes back to Islam, (according to some scholars) he may take her back if he wants or (according to other scholars) he may not. There is a difference of opinion among the scholars concerning this issue. End quote from Fataawa Noor ‘ala al-Darb.
The annulment that takes place because of apostasy is not regarded as being talaaq (divorce) according to the majority of fuqaha’.
It says in al-Mawsoo‘ah al-Fiqhiyyah (7/34): If one of them apostatises before the marriage is consummated, then the marriage is annulled immediately and neither of them can inherit from the other.
If that occurred after the marriage has been consummated, the Shaafa‘is say -- and this is also narrated in one report by the Hanbalis -- they should be separated until the end of the ‘iddah. If he comes back to Islam before the ‘iddah ends, then the marriage remains valid, but if he does not come back to Islam, the marriage is annulled with no divorce (talaaq)
Abu Haneefah and Abu Yoosuf said -- and it is also narrated in one report by the Hanbalis -- that the apostasy of one of the spouses annuls the marriage immediately, and that does not count as a talaaq divorce, whether it occurs before consummation or afterwards.
The Maalikis said, and this is also the view of Muhammad ibn al-Hanafiyyah: If one of the spouses apostatises, the marriage is annulled with an irrevocable divorce (talaaq). End quote.
And Allah knows best.