The Quran gives no worldly punishment for leaving Islam and tells people there is no compulsion in religion. Classical scholars held that apostasy was punishable by death when combined with treason or rebellion, and many modern scholars say that a person's faith is between them and God.
The fuller answer
The Quran mentions apostasy several times and speaks of punishment in the next life, but never in the courts of this world. A hadith says 'whoever changes his religion, kill him', and many classical jurists took it literally, while others, such as the Hanafis, limited it to those who fight the community. Many contemporary scholars argue that it applies to treason in a time of war, where leaving Islam meant joining the enemy.
In practice, a few countries do punish apostasy by law, and in many others families and communities put pressure on those who leave. This is a real matter that many Muslims say must be reformed, and others say the verse 'there is no compulsion in religion' makes any punishment improper.
There shall be no compulsion in [acceptance of] the religion. The right course has become clear from the wrong. So whoever disbelieves in Taghut and believes in Allah has grasped the most trustworthy handhold with no break in it. And Allah is Hearing and Knowing.
And say, "The truth is from your Lord, so whoever wills - let him believe; and whoever wills - let him disbelieve." Indeed, We have prepared for the wrongdoers a fire whose walls will surround them. And if they call for relief, they will be relieved with water like murky oil, which scalds [their] faces. Wretched is the drink, and evil is the resting place.
Indeed, those who have believed then disbelieved, then believed, then disbelieved, and then increased in disbelief - never will Allah forgive them, nor will He guide them to a way.
This answer follows the mainstream Sunni understanding and is general learning, not a fatwa. Where Muslims differ, the answer says so. Have a question of your own? Write to us.