Imam al-Shafi'i (may Allah have mercy on him) said: "Allah, exalted is His praise, says: 'Except one who is compelled while his heart is at rest with faith.' [Surah al-Nahl: 106]
And disbelief has (many) rulings; so when Allah Almighty removed it (from the one who is compelled), the rulings of everything said under compulsion were removed, because when the greatest thing is removed from people, what is smaller than it is also removed."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الخلع والطلاق / Q15094