There is nothing wrong with taking medication for mental illness
Medical treatment is allowed in Islam in general terms, and is not regarded as changing the creation of Allaah. The ruling among the scholars is that it is either permitted (mubaah) or recommended (mustahabb). The Hanafis and Maalikis are of the view that medical treatment is permitted, and the Shaafa’is and some Hanbalis are of the view that it is mustahabb. The view of most of the Hanbalis is that it is better not to do it. Ahmad ibn Hanbal narrated that Anas (may Allaah be pleased with him) said: The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “When Allaah created the disease, He also created the cure, so seek the cure.” Narrated by Ahmad, 12186; classed as hasan by al-Albaani in al-Silsilah al-Saheehah, 1633.
It was narrated that Usaamah ibn Shurayk (may Allaah be pleased with him) said: The Bedouin said: “O Messenger of Allaah, should we not treat sickness?” He said, “Yes, O slaves of Allaah, treat sickness, for Allaah did not send down any disease but He also sent down its cure, except for one disease.” They said, “O Messenger of Allaah, what is it?” He said, “Old age.” Narrated by al-Tirmidhi, 2038; classed as saheeh by al-Albaani in Saheeh al-Tirmidhi.
Old age refers to the weakness and illnesses that come with old age, for which there is no cure.
It makes no difference with regard to medical treatment whether the sickness is physical, mental or nervous. The word da’ (disease, sickness) in the ahaadeeth is general in meaning and includes all kinds of sickness.
Shaykh ‘Abd al-‘Azeez ibn Baaz (may Allaah have mercy on him) said:
It is permissible to treat sickness according to scholarly consensus. The Muslim may go to a doctor for internal sickness, injuries, nervous problems and so on, for him to diagnose his sickness and treat it appropriately, using medicines that are permitted according to Islam, according to his medical knowledge, because this comes under the heading of taking the usual means, and it does not contradict the idea of putting one's trust in Allaah. Allaah has sent down the disease and He has sent down the cure; those who know it know it, and those who do not know it do not know it, but Allaah does not put the healing for His slaves in something that He has forbidden to them.
It is not permissible for a sick person to go to the soothsayers or fortunetellers who claim to have knowledge of the unseen, in order to find out from them what his sickness is. Nor is it permissible for him to believe what they tell him, for they speak without knowledge or they summon the jinn to ask their help in doing what they want to do. The ruling on these people is that they are kaafirs who are misguided, if they claim to have knowledge of the unseen…
Majmoo’ Fataawa al-Shaykh Ibn Baaz, 3/274
Although it is permissible to use physical medicine, the sick person should also look for spiritual remedies as prescribed in Islam, in which Allaah has put the cure for both physical and mental illness, such as ruqyah as prescribed in Islam, in which Qur’aan or words narrated in the Sunnah are recited.
The scholars of the Standing Committee said, answering a similar question:
Trust in Allaah and think positively of Him; delegate your affairs to Him, and do not despair of His mercy, bounty and kindness, for He has not sent down any disease but He has also sent down the cure. You should take the means and continue to consult specialist doctors who have knowledge of disease and its treatment. Recite Soorat al-Ikhlaas, Soorat al-Falaq and Soorat al-Naas over yourself three times, and blow into your hands after each time, and wipe your face and whatever you can reach of your body. Do that repeatedly night and day and when going to sleep. Also recite over yourself Soorat al-Faatihah at any time of night or day, and recite Aayat al-Kursiy when you lie in your bed at night. These are the best ruqyahs with which a person may treat himself and protect himself from evil. Call upon Allaah by reciting the du’aa’ for one who is in distress, and say:
“Laa ilaaha ill-Allaah al-‘Azeem al-Haleem, laa ilaaha ill-Allaah rabb al-‘arsh il-‘azeem, laa ilaaha ill-Allaah rabb al-samawaati wa rabb al-ard wa rabb al-‘arsh il-‘azeem (There is no god but Allaah, the All-Mighty, the Forbearing, there is no god but Allaah, the Lord of the mighty Throne, there is no god but Allaah, Lord of the heavens, Lord of the earth, and Lord of the mighty Throne).”
Also treat yourself with the ruqyah of the Messenger of Allaah (peace and blessings of Allaah be upon him):
Allaahumma Rabb an-naas, mudhhib al-ba’s ishfi anta al-Shaafi, laa shaafiya illa anta, shifaa’an laa yughaadir saqaman (O Allaah, Lord of mankind, the One Who relieves hardship, grant healing, for there is no healer but You, a healing that leaves no trace of sickness)
And recite other dhikrs and ruqyahs and du’aa’s which are mentioned in the books of hadeeth, and which are mentioned by al-Nawawi in Riyaadh al-Saaliheen and Kitaab al-Adhkaar.
Fataawa al-Lajnah al-Daa’imah, 1/297
We ask Allaah, the Lord of mankind, to take away your pain, and to heal you of what you are suffering. We urge you to be patient and to seek reward with Allaah for what has befallen you, and we hope that Allaah will reward you and relieve you of your distress.
And Allaah knows best.