Islam cares much for the well-being of its followers. It never allows a Muslim to destroy himself or others or cast himself into destruction by his own hands. This is clear in the so many Hadiths of the Prophet (peace and blessings be upon him) and so many Qur’anic verses.
Sheikh Yusuf Al-Qaradawi wrote in his book The Lawful and the Prohibited in Islam, under the title “Medical Necessity”: There is a difference of opinion among jurists, regarding some of the prohibited food substances (like pig meat or ingredients) being used as medicine, some do not consider medicine to belong in the category of a compelling necessity like food, and in support of their position they cite the Hadith: “Assuredly Allah did not provide a cure for you in what He has prohibited to you.”(Reported by Al-Bukhari on the authority of IbnMas`ud.)

Others consider the need for medicine equal to that of food, as both are necessary for preserving life. In support of their position that prohibited food substances may be used as medicine, they argue that the Prophet (peace and blessings be upon him) allowed `Abdur-Rahmanibn `Awf and Az-Zubayribn Al-`Awwam to wear silk because they were suffering from scabies. (The text of this Hadith is quoted in the subsection of this book entitled “Clothing and Ornaments.”)

Perhaps this latter view is closer to the spirit of Islam which, in all its rules and teachings, is concerned with the preservation of human life. However, taking medicine containing some haram (prohibited) substances is permissible only under the following conditions:

1. The patient’s life is endangered if he does not take this medicine.

2. No alternative or substitute medication made from entirely halal (lawful) sources is available.

3. The medication is prescribed by a Muslim physician who is knowledgeable as well as Allah-fearing.

We may, however, add that on the basis of our own observations and the opinions of expert physicians, we have arrived at the conclusion that there hardly exists any medical necessity which requires ingesting what is haram, as for example, taking medicine. Nevertheless, we have stated this principle in case a Muslim happens to be in a place where he cannot find medications other than those which contain haram substances.

Based on the above mentioned, every Muslim has to try to find a lawful alternative first. If there is nothing, then they can use that medication after consulting a trustworthy Muslim physician. We should exert efforts to our best in this regard.