There are Hadith narrations addressing the only 3 times where a Muslim can be killed, saying the following:
“The Messenger of Allah (ﷺ) Said: The blood of a Muslim man who testifies that there is no god but Allah and that Muhammad is Allah's Apostle should not lawfully be shed except only for one of three reasons: a man who committed fornication after marriage, in which case he should be stoned; one who goes forth to fight with Allah and His Apostle, in which case he should be killed or crucified or exiled from the land; or one who commits murder for which he is killed.”
Sunan Abi Dawud 4353. Grade: Sahih Al-Albani
The Messenger of Allah [SAW] said: "It is not permissible to shed the blood of a Muslim except in three cases: An adulterer who had been married, who should be stoned to death; a man who killed another man intentionally, who should be killed; and a man who left Islam and waged war against Allah, the Might and Sublime, and His Messenger, who should be killed, or crucified, or banished from the land."
Sunan an-Nasa'i 4048. Grade: Sahih Darussalam
This lays out 3, clear cut, exclusive reasons for why a Muslim can be killed (or even just exiled for the apostate here). The same “3 reason” structure that is seen in other Hadiths, which simply say “forsakes the religion and his community”, is used as proof for execution being mandated for anyone who simply becomes a kafir after being a Muslim. How can you ignore these extremely specific Hadiths which put apostasy in conjunction with waging war against the Muslims to the side to fit your agenda? If one were to see these Hadith without ever knowing of the other broader definition of the “apostasy” apparently seen in other Hadith, they would undoubtedly assume it is referring to a form of military treason. But even then, the Hadiths that just say “leaving the community” rather than waging war indicate an abandonment, which is much more than simply changing faith.
Why go with the broader and looser definition of just changing one’s faith, when we have a more specific one, which also fits in with the “no compulsion in religion” verse, without making you have to say that the compulsion “only applies to conversion INTO Islam.”
For other Hadiths that state “whoever discards his religion, kill him,” I think it’s very clear from the Hadith I provided that due to the sociopolitical circumstances of the time of the Prophet, leaving Islam was seen synonymously many times to fighting against the Muslims as there were many wars being fought, as well as a lot of valuable intelligence and responsibilities afforded to those who were Muslim due to it being a much smaller and tight knit community. This is evident from the fact that the Hadiths I provided replaced “leaving Islam” with “fighting with Allah and his Apostle.” However, in today’s scope (yes that matters because of the following) even in an Islamic Sharia State, today there wouldn’t be the same level of a tight knit small community as it was in Early Islam. This means it would be difficult to see how one leaving Islam today would be synonymous to waging war against the Muslims.
Many who believe that apostasy doesn’t link to direct treason as in warfare or abandonment cite the consensus of the scholars of past to further bolster their evidence. While it is undoubtedly true there is a consensus in this regard, to act as if there is no difference in the perspective of the scholars from a classical Islamic community many centuries ago on how these things are linked, and how we can observe the link today, is wrong. And to act as if the scholars are infallible is wrong. It is very arguable that for the same reasons I stated last paragraph, that the scholars simply didn’t distinguish between an apostate simply changing their faith, vs an apostate waging war against the Muslims, due to the nature of how the climate was during Earlier Islam. However, to just cite the opinions of the scholars and not realize this reality is just plain misinformation. To claim that “this is the consensus, and there is nothing to indicate that it has to do specifically with war or abandonment or treason” is simply incorrect.
I would like to see how someone could reconcile all of this with the idea that the death penalty applies to all forms of apostasy. This at the very least casts a strong doubt over it.