All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
We are ordered and urged by the Sharee’ah to seek medical treatment, as Allaah has created a cure for every disease. Jaabir narrated that the Prophet said: “For each disease there is a cure, and when the (right) treatment is given, the disease is cured by the Will of Allaah.” [Muslim]
However, it is Islamically forbidden to seek treatment with what is forbidden except for a necessity as we clarified in Fataawa 108142 and 106469.
Therefore, if it is proven that those pills contain gelatin extracted from pig, then it is not permissible to use it except in case of necessity when there is no lawful alternative. Of course, it is the trustworthy Muslim doctor who should recommend using it.
Nonetheless, if the substance that is extracted from pig is totally transformed before mixing it and adding it to the other ingredients, in a way that it had totally become another substance, then its ruling changes and, in this case, it becomes permissible to use the medicine that is mixed with it.
Allaah Knows best.