Makhdum Zayn Uddin Al Malabari quotes from Imam Ghazali (Allah have mercy on them),
Non-religious sciences may be blameworthy, praiseworthy or neutral. As for those which are praiseworthy, they are the sciences connected with the wellbeing of humanity in this life, such as medicine and mathematics.
…..medicine, since it is necessary for the preservation of bodily health
And do not be surprised by our statement that medicine and mathematics are communal obligations,…….because if these trades were to disappear, human society would be exposed to destruction.
…….As the One who created the disease also created the cure, and guided humanity to the use of the latter, and prepared the causes for its benefit, it is not permissible for humans to allow themselves to be destroyed by self-neglect.
The Guidance for the Intelligent