Praise be to Allah.
The punishment for apostasy from the religion of Islam is execution. Allaah says (interpretation of the meaning):
“And whosoever of you turns back from his religion and dies as a disbeliever, then his deeds will be lost in this life and in the Hereafter, and they will be the dwellers of the Fire. They will abide therein forever”
And it was proven that the Prophet (peace and blessings of Allaah be upon him) said: “Whoever changes his religion, execute him.” Narrated by al-Bukhaari in his Saheeh. What this hadeeth means is that whoever leaves Islam and changes to another religion and persists in that and does not repent, is to be executed. It was also proven that the Prophet (peace and blessings of Allaah be upon him) said: “It is not permissible to shed the blood of a person who bears witness that there is no god but Allaah and that I am the Messenger of Allaah except in three cases: a life for a life, a previously-married person who commits adultery, and one who leaves Islam and forsakes the jamaa’ah.” Narrated by al-Bukhaari and Muslim.
This harsh punishment is for a number of reasons:
1 – This punishment is a deterrent to anyone who wants to enter Islam just to follow the crowd or for hypocritical purposes. This will motivate him to examine the matter thoroughly and not to proceed unless he understands the consequences of that in this world and in the Hereafter. The one who announces his Islam has agreed to adhere to all the rulings of Islam of his own free will and consent, one of which rulings is that he is to be executed if he apostatizes from the faith.
2 – The one who announces his Islam has joined the jamaa’ah (main body) of the Muslims, and whoever joins the main body of the Muslims is required to be completely loyal and to support it and protect it against anything that may lead to fitnah or destroy it or cause division. Apostasy from Islam means forsaking the jamaa’ah and its divine order, and has a harmful effect on it. Execution is the greatest deterrent that will prevent people from committing such a crime.
3 – Those Muslims who are weak in faith and others who are against Islam may think that the apostate has only left Islam because of what he has found out about its real nature, because if it were the truth then he would never have turned away from it. So they learn from him all the doubts, lies and fabrications which are aimed at extinguishing the light of Islam and putting people off from it. In this case executing the apostate is obligatory, in order to protect the true religion from the defamation of the liars and to protect the faith of its adherents and remove obstacles from the path of those who are entering the faith.
4 – We also say that the death penalty exists in the modern laws of man to protect the system from disorder in some situation and to protect society against certain crimes which may cause its disintegration, such as drugs etc. If execution can serve as a deterrent to protect man-made systems, then it is more appropriate that the true religion of Allaah, which Falsehood cannot come to it from before it or behind it [cf. Fussilat 41:42], and which is all goodness, happiness and tranquility in this world and in the Hereafter should punish those who commit acts of aggression against it and seek to extinguish its light and defame its image, and who fabricate lies against it to justify their apostasy and deviation.
Fataawa al-Lajnah al-Daa’imah, 21/234-231.