Praise be to Allah.
Using medicines is prescribed in general terms.
It was narrated that Abu’l-Dardaa’ (may Allaah be pleased with him) said: “The Messenger of Allaah (peace and blessings of Allaah be upon him) said: ‘Allaah created the disease and the remedy, so treat disease but do not treat it with things which are 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, shall we not use medicine?’ He said, ‘Yes, O slaves of Allaah, use medicine, for Allaah does not create any disease but He also created its cure, except for one disease.’ They said, ‘O Messenger of Allaah, what is that?’ He said, ‘Old age.’”
(Narrated by al-Tirmidhi, 2038; he said, (it is) hasan saheeh. Also narrated by Abu Dawood, 3855; Ibn Maajah, 3436).
Using medicine does not contradict the idea of putting one’s trust in Allaah (tawakkul).
Ibn al-Qayyim said:
In the saheeh ahaadeeth there is the command to use medicine, and 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, true Tawheed cannot be attained unless one takes the means which Allaah created and which lead to the ends both in terms of divine decree and in terms of sharee’ah. Neglecting the means undermines the essence of putting one’s trust in Allaah and undermines the Divine command and wisdom, because the one who neglects them thinks that this is a sign of stronger trust in Allaah. But neglecting them is a sign of helplessness which contradicts putting one’s trust in Allaah, the essence of which is the heart’s dependence on Allaah to acquire that which will benefit a person in both his religious commitment and worldly affairs, and will ward off that which will harm him in both his religious commitment and worldly affairs. Alongside this dependence one must also take the means, otherwise one will be ignoring the wisdom and command of Allaah. We should not regard helplessness as putting our trust in Allaah, or putting our trust in Allaah as helplessness.
Zaad al-Ma’aad, 4/15
And Allaah knows best.