Please reply to the question according to the Hanafi school of thought. If a person says, "If I am not speaking the truth, then I am not a muslim." and he lied, then will he be excluded from the religion of Islam? If he were to be excluded from the religion of Islam, then what would happen to his marriage with his wife?
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, sallallaahu ʻalayhi wa sallam, is His slave and Messenger.
The Hanafis held different opinions regarding the person who swears that he is a non-Muslim if he had done such-and-such in the past tense. The preponderant view according to the Hanafis is that such a person is not to be declared a disbeliever as long as he did not intend proclaiming disbelief. ʻAlaa’ Ad-Deen As-Samarqandi wrote:
“As for the one who says, 'I am a Jew or a Christian if I had done such-and-such,' while deliberately lying, he is not liable for expiation according to our school in this case. However, scholars held different opinions whether he is to be declared a disbeliever for uttering such a statement or not. The preponderant view is that he is not to be declared a disbeliever, and this view has been reported by Al-Haakim Ash-Shaheed on the authority of Abu Yoosuf because the sayer did not hold the intention of declaring disbelief; rather, he was merely intending to confirm his statement. The same ruling applies to the one who says, ‘Allaah knows that I did such-and-such,' while knowing for sure that it is a lie and that he did not do that thing. There is no explicit opinion reported on the authority of Imaam Abu Haneefah in this regard. Rather, the Hanafi scholars held different views in this regard; the most correct of which is that he is not to be declared a disbeliever.
There is another opinion that suggests that this applies only if the sayer does not believe that he is to be declared a disbeliever if he said that, but if he (the sayer) believes that he is to be declared a disbeliever when taking such an oath in the past or future tense and breaks it, then such a person is declared a disbeliever because he willfully took that oath and thus willfully chose disbelief; willful choice of disbelief constitutes an act of disbelief.” [Tuhfat Al-Fuqahaa': 2/300]
“If a person takes an oath in the past, as if saying, 'I am a Jew, a Christian, or a disbeliever if I did such-and-such,' while knowing that he had done that thing, then Muhammad ibn Muqaatil said, ‘He is to be declared a disbeliever because his statement apparently implies that he is emphasizing his disbelief if he is lying.’ However, Nusayr ibn Yahya wrote to Ibn Shujaa’ asking him about the ruling in this regard; he replied, 'Such a person is not to be declared a disbeliever because the criterion is the conviction, and he did not hold disbelief while taking such an oath; rather, he intended to emphasize his statement.' This is the preponderant view in this regard...” [Al-Jawharah An-Nayyirah]
Hence, the marriage of such a person is intact, and this incident has no effect on the validity of his marriage.
Allaah knows best.
You can search for fatwa through many choices