Praise be to Allah.
1 – Medicines are prescribed in general terms
It was narrated that Abu’l-Dardaa’ (may Allaah be pleased with him) said: the Messenger of Allaah SAWS (peace and blessings of Allaah be upon him) said: “Allaah created the disease and the cure, so treat disease but do not treat it with anything that is haraam.”
(Narrated by al-Tabaraani in al-Mu’jam al-Kabeer, 24/254. This hadeeth was classed as saheeh by al-Albaani in al-Silsilah al-Saheehah, 1633).
It was narrated that Usaamah ibn Shurayk (may Allaah be pleased with him) said: the Bedouins said, “O Messenger of Allaah, should we not use medicine?” He said, “Yes, O slaves of Allaah, use medicine, for Allaah did not create any disease but He also created the cure for it, except for one disease.” They said, “O Messenger of Allaah, what is it?” He said, “Old age.”
(Narrated by al-Tirmidhi, 2038. He said it is hasan saheeh; Abu Dawood, 3855; Ibn Maajah, 3436).
2 – Using medicine does not cancel out the idea of putting one’s trust in Allaah
Ibn al-Qayyim said:
In the saheeh ahaadeeth there is the command to use medicine, and these ahaadeeth state that this does not contradict the idea of putting one’s trust in Allaah, just as warding off hunger, thirst, heat and cold by means of their opposites does not contradict it. Rather the reality of Tawheed cannot be perfected without following the means which Allaah has created in order to reach ends, both by His universal will and in His laws that He has prescribed. Ignoring this matter undermines the very essence of putting one’s trust in Allaah, just as it undermines the concept of Allaah’s command and wisdom, and weakens it so that the one who does not use the means to an end thinks that not using them is a stronger form of putting one’s trust in Allaah. But not using the means to an end is a sign of weakness which contradict the idea of putting one’s trust in Allaah, the essence of which is the reliance of the heart on Allaah to provide that which will benefit a person in this world and in the Hereafter, and to ward off that which will harm him in this world and in the Hereafter. But it is essential to depend on use of the means, otherwise one is denying the wisdom of Allaah and the laws which He has prescribed. So the slave of Allaah should not call his helplessness dependence on Allaah, or call his dependence on Allaah helplessness.
Zaad al-Ma’aad, 4/15.
And Allaah knows best.