Euthanasia or mercy killing is the act or practice of ending the life of an individual suffering from a terminal illness or an incurable condition, through lethal injection or the suspension of extraordinary medical treatment.
This act is Islamically forbidden for it encompasses a positive role on the part of the physician to end the life of the patient and hasten his death via lethal injection, electric shock, a sharp weapon or any other way. This is an act of killing and killing is a major sin and thus forbidden in Islam, the religion of pure mercy.
As for the suspension of medical treatment via preventing the patient from his due medication which is, from a medical perspective, thought to be useless, this is permissible and sometimes it is even recommended. Thus, the physician can do this for the sake of the patient's comfort and the relief of his family. Nothing is wrong in this, God willing.
It is highly stressed here that medical treatment is deemed non-obligatory by the majority of Muslim scholars and the founders of the famous schools of Islamic jurisprudence. Rather, to them, it is permissible. Only a few number of Muslim scholars maintain that it is obligatory, as said by some followers of Imam Ahmad and Ash-Shafii. Also, others maintain that applying medical treatment is commendable and preferable.
Moreover, some scholars disputed over which is better for the patient: treatment or showing endurance. Some who maintain that showing endurance is far better base their judgment on the narration of Ibn Abbas in the two Sahihs that `Ata Ibn Abu Rabih said: Ibn Abbas said to me: "May I show you a woman of Paradise?" I said: "Yes." He said: "Here is this dark-complexioned woman. She came to Allah's Messenger, peace and blessing be upon him, and said: "I am suffering from epilepsy and convulsive seizures make me naked; supplicate Allah for me." Thereupon, the Prophet, peace and blessing be upon him, said: "You can show endurance and win entry to Paradise, but if you like, I'll pray to Allah for your recovery." She said: "I am prepared to show endurance but I get naked due to convulsions, so supplicate Allah to spare me getting naked." And the Prophet, peace and blessings be upon him, did pray for her." (Al-Bukhari and Muslim)
These are the views of the scholars of the Umma on treatment and medication; most of them maintain that it is permissible; some maintain that it is recommended; and a few number of them deem it obligatory. I myself agree with those who deem it obligatory in case the pain gets unbearable, and the illness is curable, by Allah's grace.
This is also compatible with the guidance of Prophet Muhammad, peace and blessings be upon him, who sought treatment for himself and ordered his honorable Companions to seek treatment as well; this is confirmed by Ibn al-Qayyim in Zad al-Maad (provision of the hereafter).
But in cases when sickness gets out of hand, and recovery happens to be tied to miracle, in addition to ever-increasing pain, no one can say treatment then is obligatory or even recommended. Thus, the physician's act of stopping medication, which happens to be of no use, in this case may be justified, as it helps in mitigating some negative effects of medications, and it enhances death. But it's different from the controversial "mercy killing" as it does not imply a positive action on the part of the physician; rather, it is some sort of leaving what is not obligatory or recommended, and thus entails no responsibility.
To conclude, the physician can practice this for the sake of the patient's comfort and the relief of his family. Nothing is wrong in this.