Can Anyone leave Islam in front of someone if he fears that it can cause him death. I need hadees reference
One may pretend to leave Islam, and declare disbelief only from their tongue. This concession is proven from the Quran:
من كفر بالله من بعد إيمانه إلا من أكره وقلبه مطمئن بالإيمان ولكن من شرح بالكفر صدرا فعليهم غضب من الله ولهم عذاب عظيم
Whoever disbelieves in Allah after his belief... except for one who is forced [to renounce his religion] while his heart is secure in faith. But those who [willingly] open their breasts to disbelief, upon them is wrath from Allah, and for them is a great punishment;
It is related about Ammar ibn Yasir that his parents were killed and he was tortured until he faked Kufr to escape it. He became immensely sorrowful and came to the Prophet Muhammad ﷺ and the Prophet permitted him to the repeat the same in the future. (Mustadrak al-Hakim).
There is consensus on the matter:
أجمع أهل العلم على أن من أكره على الكفر حتى خشي على نفسه القتل ، أنه لا إثم عليه إن كفر وقلبه مطمئن بالإيمان
There is consensus of the people of knowledge that the one who is forced to disbelieve until he fears being killed, then there is no sin on him if he does Kufr, on the condition that he remains a believer in his heart
وأجمع العلماء على : أن من أكره على كلمة الكفر ، يجوز له أن يقول بلسانه ، وإذا قال بلسانه غير معتقد لا يكون كفرا
The Ulema are unanimously agreed that if a person is forced to say a statement of disbelief, then it is permitted for him to utter that from his tongue and if he says so from his tongue without accepting it, then this is not Kufr
It is also permitted to remain steadfast and even get killed for doing so. This is the more virtuous action as the death is martyrdom and the show of patience earns esteem for Islam and frustrates the disbelievers.
أجمع العلماء على أن من أكره على الكفر فاختار القتل أنه أعظم أجرا عند الله ممن اختار الرخصة
The consensus of the Ulema is that one who is forced to disbelief and chooses to be killed instead, has a greater reward with Allah than the one who takes the concession.
وإن أبى أن يقول حتى يقتل كان أفضل
And if he refuses until he is killed then that is better
Among the Sahabah who chose to do so were Bilal ibn Rabah, Khubayb ibn Adiy, Habib ibn Zayd al-Ansari, Abdullah ibn Hudhafah etc.