In Islamic terms, apostasy means for one to openly express and show his/her renouncement of religion and usually ends up in others being encouraged to do the same. The punishment for apostasy doesn’t apply to one who has turned away from religion but doesn’t announce it. Therefore, it is correct to say that the apostate is punished for an act that has to do with society, not merely because of some personal beliefs.
The apostate violates others’ rights to have an Islamic environment in society and is a threat to the beliefs of normal people who aren’t religious experts and aren’t capable of answering all of their religious needs on their own. In the advent of Islam, a group of its enemies planned on falsely accepting Islam in the beginning of the day and turning away from it at the end of the day, undermining the faith of the believers and weakening their religious spirit as a result.[i]
In order to prevent this threat, Islam has assigned a grave punishment for those who do so, although it is also very hard to prove such a matter, to the extent that this Islamic law was put to practice only a few times during the advent of Islam. Hence, one can say that the mental affect of this punishment plays a far more important role in keeping the Islamic society healthy and clean than the punishment itself.
In order to answer this question, a few points must be paid attention to first:
1- Who does the term “apostate” (murtadd) refer to? In Islamic terms, the apostate is one who has renounced Islam and chosen to be a disbeliever. The renouncement of Islam takes place when one denies one of the pillars of Islam (tawhid, prophethood and resurrection) or one of its clear subjects that all Muslims know and believe in, given that denying the subject is equal to and necessitates the denial of prophethood itself (meaning that one can't be Muslim and not believe in it, such as the obligation of prayer, unlike other subjects that aren’t of such clarity and are sometimes even debated amongst Muslims), and that the person denying it is aware of the abovementioned necessitation.
In Islam, there are two types of apostasy; milli and fitri:
The fitri apostate is one whose parent(s) (one or both of the parents, making no difference) were/was Muslim during his/her conception, has accepted Islam after reaching puberty and then renounced it afterwards.
The milli apostate is one whose parents weren’t Muslim during his/her conception, has been a kafir after puberty, and then embraces Islam and once again becomes a kafir afterwards.
2- The punishment for apostasy in different religions and Islamic sects:
In Shia law, apostasy has certain laws that pertain to inheritance and marriage, which as it seems, the question isn't asking of (and all it is after is what the death penalty is for). The punishment for apostasy is as follows:
In the case of the fitri apostate being a male, he is to be executed and his repentance in the presence of the judge does him no good. But if he is a milli apostate, he is first asked to repent, if he does so, he is free, or else, he is also to be executed. In the case of the apostate being a female, regardless of being milli or fitri, she is first asked to repent and if she refuses to do so, she is to be imprisoned.
In Sunni law, according to most Sunni scholars, in all of the cases mentioned above, the apostate is first asked to repent, and in the case of refusal, he/she is executed.
In other religions other than Islam, apostasy is a crime and sin and its punishment is death.
Therefore, one can conclude that according to all divine religions and Islamic sects, apostasy is a crime and sin and its punishment (with a small difference in its conditions) is death.
3- The reason for such a penalty
In order to see what the reason for such a penalty is, a few points need to be noted:
a) Islamic laws are divided into personal and social ones. Social Islamic laws are legislated on the basis of the benefit of society as a whole, and sometimes in order for these “social benefits” to be reached, personal freedom is put aside because of its lower priority and importance. This point is observed in all societies and isn't one that can be denied.
b) If the apostate has tried his/her best to reach the truth, he/she will surely be excused by Allah (swt) and isn't a sinner in regards with the laws that only pertain to him/her on a personal basis, yet if one doesn’t reach the truth as a result of not trying hard enough and shortcoming, he/she will be responsible for everything he/she does, no matter how personal those acts are, and will have to answer before Allah (swt). All of this is if he/she doesn’t announce apostasy.
Now, if this individual lets everyone know of his/her apostasy, this act will no longer be one that is personal and has nothing to with society, on the contrary it is one that has everything to do with it. As a result, social Islamic laws come in and apply to what this person is doing. Here, Islam says before making his/her apostasy known to others, it was a personal act, but after doing so, it is a crime, for the following reasons:
a) It is a violation of others’ rights, because it causes doubt in the minds of others and undermines the religious spirit in society. Since everyone isn't qualified to answer all questions on religion, they see it as their right to at least have a religious environment in society without all the doubting and questioning.
b) Even if we overlook the first reason, Islam considers such a matter to the benefit of the Muslim society, and that is why it has encouraged the veneration of Islamic sacraments and has prohibited their disrespect.
Conclusion: Although apostasy isn't a crime from an individual perspective, yet it is one when looked at socially.
3- Considering the fact that apostasy is a crime, the reasoning behind its punishment can be summarized in the following:
a) Deserving punishment
The reason why a punishment has been assigned for this act is because apostasy causes disorder in the moral harmony of society. The more the moral and religious disorder an act causes, and the more rights it violates, the heavier the punishment needs to be. Clearly, a society that isn't in complete religious health and is declining by the day, is far from true prosperity and salvation, regardless of how ahead it is in technology. This is why any act other than apostasy that harms the faith and beliefs of others also deserves punishment; let it be offending the prophet (pbuh) or the imams (as) (God forbid) or any other act, because when the holiness and sanctity of sacred matters and things is violated, the doors are opened for the falsification, distortion and abolishment of religion.
b) Preventing the apostate from publicly endorsing apostasy and propagating it any further
As long as the apostate hasn’t disclosed his/her apostasy, he/she hasn’t committed any “social crime” yet, and the punishment for such an act will prevent him/her from spreading it in order not to be punished as a result.
c) Showing the significance of religion to society
The different laws each government has shows what things are of higher importance to it. The heavy punishment that has been given to apostasy signifies how important it is for society to have a faithful spirit.
d) An encouragement to do more comprehensive research on religion before accepting it
This punishment encourages those who aren’t Muslim to be careful when choosing Islam and have a very good reason for doing so, preventing weak faith.
e) The reduction of punishment in the hereafter
According to Islam, punishment in this world reduces punishment in the hereafter. Allah’s (swt) kindness doesn’t allow Him to punish a person twice for the same sin. Hadiths disclose that in the beginning of Islam, many had this belief and people were encouraged to confess to their sins so that they would be purified in this world by being punished. Of course, there is a much better way for one to be purified of all sins in this world, and that is to truly repent from any committed sins. If a sinner truly repents, he/she will no longer need to be punished even in this world in order to be purified; that is how kind Allah (swt) is.
4- Question: The reasons behind why apostates are punished (that were mentioned above), and also the reason that the Quran says about the conspiracy of the People of the Book don’t always apply to all apostates, in other words, not all of them intend to misguide others, and in some cases, their apostasy has none of the negative effects mentioned above, but why are they still punished the same way?
Answer: Usually, considering the reasons for a law, it (the law) covers more cases than it is supposed to (and might cover some cases that all of the reasons haven’t gathered in), and that is what is meant by “cautious legislation”. There are many reasons for this caution, namely:
a) Sometimes all of the conditions that must be precisely met for a certain law to be carried out don’t have the capability of being easily recognized. For instance, the reason for why it is the law not to park in the street is because traffic flow will slow down and other dangers, while this reason no longer applies on days that the street isn't busy. Yet, the police will never entrust normal people with seeing what the status of traffic flow is.
b) Sometimes a law is of so much importance that the one legislating it makes the area its subject covers vaster than that of which the reason for the law might call for, in order to make sure that all people will observe it. For example, sometimes the army wants some military establishments to remain secret and can achieve that by closing five kilometers around it, yet it closes much more and maybe even a couple times more than that amount just to make sure because of the importance of the matter.
The same goes for Islam; sometimes because of the importance of the subject, laws cover more instances than their reasons might call for, as a precaution for that law to be completely observed and the full accomplishment of the goal behind it.
For further information on the reasons behind Islamic penalties, see:
Qudratullah Khosroshahi and Mostafa DaneshPajuh, Falsafeye Huquq, pp.201-222; Morteza Mutahhari, Adle Elahi; the tafsir of the verse "لا اکراه فى الدین" in Tafsir Al-Mizan, vol.2, pg.278; Tafsir Nemouneh, vol.2, pg.360.
 Imam Khomeini, Tahrirul-Wasilah, vol.2, pg.366; Ibn Quddamah, Al-Mughni, vol.10, pg.74.
 Ibid, vol.1, pg.118.
 Ibid, vol.2, pg.366; Some believe that one of the parents must be Muslim during the child’s birth (Ayatullah Khu’i, Mabani Takmilatil-Minhaj, vol.2, pg.451) and others don’t consider announcing and embracing faith after puberty as one of the conditions (Shahid Thani, Masalikul-Afham, vol.2, pg.451).
 Imam Khomeini, Tahrirul-Wasilah, vol.2, pg.336.
 Ibid, vol.2, pg.494.
 Abdurrahman Al-Jaziri, Al-Fiqh alal-Madhahibil-Arba’ah, vol.5, pg.424; As with the Shia, Abu-Hanifa also puts a difference between men and women. (AbuBakr al-Kasani, Bada’i’ul-Sanaye’, vol,7, pg.135) and Hasan Basri doesn’t believe in asking the apostate to repent. (Ibn Qudama, Al-Mughni, vol.10, pg.76).
 See: (Deut. 13:6-11).
 Of course some believe that the death penalty isn't the hadd for apostasy, but it is the ta’zir for such an act (sometimes Islam assigns a certain punishment for a certain act [this punishment is called a hadd] and sometimes it just says that the committer of a certain act needs to be punished [tazir] without mentioning any specific punishment, therefore it is up to the Islamic ruler to choose how how he/she is to be punished), hence, one can't say that Islam’s penalty for apostasy is death. See: Hosein-Ali Montazeri, Dirasatun fi Wilayatil-Faqih wa Fiqhil-Dowlah al-Islamiyyah, vol.3, pg.387; also see: Isa Wilayi, Irtidad dar Islam, pp.129-148.
 Allah (swt) says: "لا یکلف اللَّه نفساً الّا وسعها" Baqarah:286.