Answer: If a substance or medicine is mixed with something else and undergoes a transformation—where its nature changes due to chemical processes or other factors—then the ruling changes. In that case, it becomes permissible.
For example, if a medicine contains pork but has been altered to the extent that its original properties no longer exist due to a transformative process, then its ruling changes, and it is permissible to use. This is because the fundamental principle regarding things we benefit from is permissibility. This principle is well established in Usul al-Fiqh.
Allah says in the Qur’an:
هُوَ ٱلَّذِى خَلَقَ لَكُم مَّا فِى ٱلْأَرْضِ جَمِيعًا
"It is He who created for you all that is on the earth." (Surah Al-Baqarah 2:29)
The Prophet ﷺ also said in a hadith reported by Imam al-Tirmidhi and Ibn Majah, narrated from Salman al-Farisi (رضي الله عنه), and graded hasan by Shaykh al-Albani in Sahih al-Jami’:
" الْحَلاَلُ مَا أَحَلَّ اللَّهُ فِي كِتَابِهِ وَالْحَرَامُ مَا حَرَّمَ اللَّهُ فِي كِتَابِهِ وَمَا سَكَتَ عَنْهُ فَهُوَ مِمَّا عَفَا عَنْهُ "
‘What is lawful is that which Allah has permitted, in His Book and what is unlawful is that which Allah has forbidden in His Book. What He remained silent about is what is pardoned.’ (Sunan Ibn Majah 3367)
If a substance goes through a process that changes its fundamental nature, it becomes permissible. The default position is that things are allowed unless there is a clear prohibition.
Alcohol (khamr) is haram to drink, and using it is also prohibited. However, if its nature changes—such as turning into vinegar—then it becomes permissible. The Prophet ﷺ praised vinegar, as has been reported in the hadith:
عَنْ عَائِشَةَ أَنَّ النَّبِيَّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ قَالَ نِعْمَ الْأُدُمُ أَوْ الْإِدَامُ الْخَلُّ
Aisha reported: The Prophet, peace and blessings be upon him, said, “The best of condiments or toppings is vinegar.” (Sahih Muslim 2051)
But if the alcohol or pork undergoes some changes yet retains its essence, then the ruling remains impermissibility. For example, if alcohol is turned into a solid form or incorporated into another product without fundamentally altering its properties, that does not make it permissible. The same applies to pork or any other haram ingredient—if its essential nature remains unchanged, it remains haram.
The evidence for this is a hadith in Sahih al-Bukhari and Sahih Muslim, where the Prophet ﷺ said:
" قَاتَلَ اللَّهُ الْيَهُودَ، إِنَّ اللَّهَ لَمَّا حَرَّمَ شُحُومَهَا جَمَلُوهُ ثُمَّ بَاعُوهُ فَأَكَلُوا ثَمَنَهُ ".
"May Allah curse the Jews, for Allah made the fat (of animals) illegal for them, yet they melted the fat and sold it and ate its price." (Sahih al-Bukhari 2236)
Since the essence of the fat remained, altering its form did not make it permissible.
In the case of the medicine the questioner is asking about, this requires expert evaluation. Doctors, pharmacists, or chemists should be consulted to determine whether the haram substance in the medication has been entirely transformed. If they confirm that it has changed completely and its original nature no longer exists, then it is permissible to use. However, if they confirm that the original haram substance is still present in its essence, then it remains impermissible.
If a person is in a situation where they must take medicine containing haram substances and no halal alternative is available, then they are allowed to use it out of necessity. Allah says in the Qur’an:
فَمَنِ ٱضْطُرَّ غَيْرَ بَاغٍ وَلَا عَادٍ فَإِنَّ رَبَّكَ غَفُورٌ رَّحِيمٌ
But whoever is forced [by necessity], neither desiring [it] nor transgressing [its limit], then indeed, your Lord is Forgiving and Merciful. (Surah Al-An’am 6:145)
The scholars also state:
"Necessity permits what is otherwise forbidden."
However, once the necessity is no longer present—either because the person has recovered or a permissible alternative becomes available—they must stop taking that medicine. The ruling of necessity is limited to the extent of the need.
Allah knows best.
— Answered by Ustadh Abdulrahman Hassan