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."
Sayyiduna Abdullah bin Abbas (may Allah be pleased with him) said that the Messenger of Allah (peace and blessings be upon him) said: "Allah, the Lord of Might, has pardoned my Ummah for mistakes, forgetfulness, and what they are compelled to do."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الخلع والطلاق / 15094