.... Although there are about 20 references to apostasy in the Quran, he explains, none of these references prescribes the death penalty. One who turns his back on his faith, who renounces his faith, the person incurs the curse and the wrath of Allah, but no punishment is given says Professor Kamali. It is only in the hadith that punishment, the death penalty, is prescribed.
Professor Kamali explains the context in which this hadith arose. “After the Prophet’s migration to Medina several instances of apostasy were recorded. There were some people who renounced Islam, made derogatory remarks about the character of the Prophet and his mission. Immediately after doing so they would leave Medina and join Mecca.
So eventually the Prophet uttered hadith, that one who changes his religion shall be killed, and this became the law of apostasy” he said. [The Express Tribune News Network] Read more [via National Secular Society]