بسم الله الرحمن الرحيم
(Fatwa: 647/648/B=7/1438)
The person who swears this oath, if he has the belief at the time of taking the oath that by saying so he shall become kafir then in such a case when the condition is found he shall become kafir. One must not swear such oaths. And in case he is unaware that it is an oath or does not believe about being kafir then he shall not become kafir by swearing in this way, but the oath shall take place and kaffarah will be wajib if he does so. This issue is discussed in Shami vol. 5.
Allah knows Best!
Darul Ifta,
Darul Uloom Deoband