Instances of suicide or self-killing have been known throughout recorded history.
It was known and discussed in the ancient Greek and Roman civilizations; it has been noted in the Jewish and Christian faiths and is mentioned in the classical Hindu books.
Suicide or hara kiri is part of the ancient Japanese honor code and is noted in Asian cultures. It is not something confined to Western civilization and is even found in Muslim majority countries even though it is well known that it is something clearly prohibited in Islam.
The Gift of Life
In the Quran there are sanctions against suicide.
And do not kill yourselves. Surely, God is Most Merciful to you. (Quran 4:29)
And do not throw yourselves in destruction. (Quran 2:195)
The Quran makes it clear that human life is sacred. Life cannot be taken without justification and the right to life is inherent in the tenants of Islam. Life itself is a gift from the Creator that we are obliged to care for.
Suicide out of despair of God’s mercy or worldly problems is strictly forbidden. Prophet Muhammad, may God praise him, said:
Whoever kills himself with something in this world will be punished with it on the Day of Resurrection. 
It is a major sin and its punishment is subject to the will of God. If He wills, He will forgive it, and if He wills He will punish for it. 
Life is an unending succession of moments. At the two extremes there are joyful moments that make our hearts soar and dark moments that plunge us into sadness and worry or even despair.
Gladness and its opposite sadness are part of the human condition, however when we lose control over our emotions we can easily fall into despair. Despair is the feeling that we get when all hope has disappeared and it is a very dangerous situation.
God tells us not to despair and particularly not to despair of His mercy. God has not abandoned us in face of the temptations and trials we face in this world; He is ever merciful and has equipped us with potent weapons.
God, the Most Merciful, gives us clear guidelines and promises two things, if we worship Him and follow His guidance we will be rewarded with Paradise and that after hardship we will find ease.
But those who believe and do deeds of righteousness, We shall admit them to the Gardens under which rivers flow (i.e., in Paradise), to dwell therein forever. [It is] the promise of God, [which is] truth, and whose words can be truer than those of God. (Quran 4:122)
So verily, with hardship, there is ease. (Quran 94:5)
When Prophet Jacob was grieving and sad, he turned to God, and the Quran tells us that he beseeched God for relief.
He said: ‘I only complain of my grief and sorrow to God… (Quran 12:86)
Prophet Muhammad also said:
No misfortune or disease befalls a Muslim, no worry or grief or harm or distress – not even a thorn that pricks him – but God will expiate for some of his sins because of that. 
The religion of Islam is primarily concerned with making and keeping a connection with the One God. One of the biggest mistakes that people can make is to separate their worldly life from their religious life.
The Sin of Ending One’s Life
The stressful situations that cause us to despair and feel unconnected to God always originate in the affairs of this world, such as emotional issues, financial stress, substance abuse or health issues.
Especially in this new century one of the most common reasons for despair is a sense of isolation or detachment from others.
God has promised us that He is well aware of the situations that we face and He has given us weapons with which to face them.
When it comes to despair, the condition that could in some situations lead a person to contemplate taking his or her own life, we need to dig a little deeper, we need to remind ourselves first and foremost that God is Merciful and that no matter what situation we find ourselves in He is ready to forgive and help.
God the most merciful, compassionate, and beneficent has instructed us to inculcate these attributes and treat each other with respect and fairness. This includes not leaving anyone alone with their problems and worries.
A little bit of support and care might help someone avoid the sin of ending their own life. God also tells us not to mock, scorn, insult, abuse or put down one another.
O you who have believed, let not a people ridicule [another] people; perhaps they may be better than them; nor let women ridicule [other] women; perhaps they may be better than them. And do not insult one another and do not call each other by [offensive] nicknames. Wretched is the name of disobedience after [one’s] faith. And whoever does not repent – then it is those who are the wrongdoers. (Quran 49:11)
Both God and Prophet Muhammad remind us that He will punish those of us who commit injustices or oppress others.
And whoever oppresses (commits injustice) among you, We will make him taste a great punishment. (Quran 25:19)
Prophet Muhammad said:
A Muslim is a brother of another Muslim, so he should not oppress him, nor should he hand him over to an oppressor. Whoever fulfills the needs of his brother, Allah will fulfill his needs; whoever brought his (Muslim) brother out of a discomfort, Allah will bring him out of the discomforts of the Day of Resurrection, and whoever covers the faults of a Muslim, Allah will cover his faults on the Day of Resurrection. 
Thus there is certainly a benefit in treating others well, especially in coming to the aid of friends or family members who are overwhelmed by life’s cruelties and injustices.
However what of the people who feel alone, crushed by circumstance and are teetering on the edge of despair. How can a person suffering from suicidal thoughts bring themselves back from the brink?
This can be achieved in many ways; firstly by strengthening one’s relationship with God. This is achieved by reading the Quran, being mindful of Him and making lots of du’a (supplication) to God.
Next a person would do well to recognize Satan’s hand in this matter. He whispers frightening scenarios of poverty and helplessness. They are not true for God’s mercy conquers all. Cling to Him and to Islam even in the darkest hour and the longest night.
Along with the weapons mentioned earlier God also gave us Prophet Muhammad, a mercy to all the worlds, to all the people. Trying to emulate him, this will make a despairing person calmer and closer to God.
If we are mindful that God has control over all things and that He ultimately wants us to live forever in Paradise, we can begin to leave our sadness and worry behind.
If we face our fears and anxieties with complete trust in God and if we show patience and gratitude with all our circumstances, sadness and worry will disappear or at least feel lighter. Prophet Muhammad said:
Indeed amazing are the affairs of a believer! They are all for his benefit. If he is granted ease then he is thankful, and this is good for him. And if he is afflicted with a hardship, he perseveres, and this is good for him. 
 Saheeh Al-Bukhari, Saheeh Muslim
 As described by many noted Islamic scholars.