All praise is due to Allah, and peace and blessings be upon the Messenger of Allah.
If a Muslim is genuinely compelled to utter words of disbelief while his heart remains firm in faith, it is permissible for him to say those words in order to protect himself from harm, and he does not become a disbeliever because of that. Allah has granted this concession to those who are truly coerced.
Allah, the Exalted, says:
"Whoever disbelieves in Allah after having believed—except for one who is forced while his heart remains secure in faith..."
(Qur'an 16:106)
The scholars unanimously agree that whoever utters words of disbelief under genuine coercion while his heart remains steadfast in faith commits no sin and does not leave Islam.
Not every threat is considered coercion. The type of coercion that allows this concession is one involving a real fear of death, loss of a limb, or unbearable severe torture, provided that:
As for fear of losing wealth, social status, or concern about what people may say, these do not constitute the kind of coercion that permits uttering words of disbelief.
Both are permissible.
Some of the Companions, such as Bilal ibn Rabah (may Allah be pleased with him), endured the most severe forms of torture without uttering words of disbelief.
The majority of scholars hold that patience and steadfastness are better, especially if the Muslim is a role model for others or a person of knowledge, because this demonstrates the honor of Islam and firmness upon the religion.
No. If the coercion is valid according to Islamic law and the person's heart remains firm in faith, he does not become a disbeliever or a polytheist. Allah judges people according to what is firmly established in their hearts, not according to words spoken under genuine coercion.
However, one who willingly utters words of disbelief or is pleased with them falls under the warning mentioned in the Qur'an.
If a Muslim is subjected to genuine coercion, he may utter words of disbelief while his heart remains firm in faith, and he does not leave Islam by doing so. Nevertheless, according to the majority of scholars, remaining patient and steadfast—even at the risk of death—is superior because it honors the religion and demonstrates the strength of faith.
And Allah knows best.