It is Haram (prohibited) for a patient to hasten their death, whether by committing suicide or by taking medication to kill themselves. It is also Haram for a doctor, a nurse, or any other person to carry out the patient’s request, even if their disease is incurable. Anyone who assists in this shares in the sin, because they intentionally kill a human, whose life is protected by Shari‘ah (Islamic law), without a right. There are clear Nas (Islamic texts from the Qur’an or the Sunnah) prohibiting the killing of a human being without a right. Allah (Exalted be He) says:
...and kill not anyone whom Allâh has forbidden, except for a just
cause (according to Islâmic law). [Surah Al-Anam 6:151]
And:
And do not kill yourselves (nor kill one another). Surely, Allâh is
Most Merciful to you. And whoever commits that through aggression and
injustice, We shall cast him into the Fire, and that is easy for
Allâh. [Surah Al-Nisa 4:29]
Also, it was authentically reported on the authority of Abu Hurayrah (may Allah be pleased with him) that the Messenger of Allah (peace be upon him) said:
Anyone who kills themselves with a piece of iron (a weapon) will have
that piece of iron in their hand and will be stabbing their stomach
with it in the Fire of Hell forever, abiding eternally therein. Anyone
who drinks poison and kills themselves will be drinking it in the Fire
of Hell forever, abiding eternally therein. And anyone who throws
themselves from (the top of) a mountain and kills themselves will be
throwing themselves down in the Fire of Hell forever, abiding
eternally therein. (Agreed upon by Al-Bukhari and Muslim)
For example from Sunnah:
Jundub ibn ‘Abdullah Al-Bajaly (may Allah be pleased with him) narrated that the Messenger of Allah (peace be upon him) said:
Among the nations before you there was a man who got wounded, and
growing impatient (with pain), he took a knife and cut his hand with
it. The blood did not stop until he died. Allah (Exalted be He) said,
‘My slave hastened to bring about his demise; I have forbidden
Paradise to him.’ (Agreed upon by Al-Bukhari and Muslim; this is the
wording of Al-Bukhari)
Therefore, the Prophet (peace be upon him) forbade people to wish for death to put an end to their suffering. In a Hadith on the authority of Anas ibn Malik (may Allah be pleased with him), he reported that the Messenger of Allah (peace be upon him) said:
None of you should wish for death because of a calamity that has
befallen them; but if it is unavoidable to do so, let them say, ‘O
Allah, make me live as long as life is better for me and make me die
if death is better for me.’ (Related by Al-Bukhari and Muslim; this is
the wording of Al-Bukhari)
Since it is forbidden to merely wish or ask Allah for death, committing suicide or assisting in it is considered a violation of Allah’s Laws and a transgression of the sacred boundaries set by Allah. Doing this is inconsistent with being patient with what is decreed by Allah.
It challenges Allah’s Divine Decree and Predestination, and shows dissatisfaction with Allah’s Wisdom of testing His servants with evil and good as trial for them. Allah (Exalted be He) says:
...and We shall make a trial of you with evil and with good. [Surah Al-Anbiya 21:35]
Allah may try and afflict some of His servants with illness and He is the All-Wise in what He decrees and the All-Knowing of what is best for His servants, as this may bring goodness for the servant, increase their Hasanat (rewardable good deeds), the strength of their faith, and bring them closer to Allah (Glorified be He) through their resignation (to His Will), entreaties, submission, Tawakkul (putting one’s trust in Allah), and supplications to Him. If someone is afflicted with an illness, they should hope for Allah’s Reward and bear with patience their affliction. Showing patience over affliction can gain Allah’s Good Pleasure and increase heavenly reward and elevate the servant to a higher degree in the hereafter.
Source: Using euthanasia to end suffering