There is nothing wrong with using gelatine or gelatine capsules for medicine and so on, if they are derived from the skin or bones of an animal that was slaughtered in the manner prescribed in Islam.
As for those that are taken from “dead meat” (i.e., that which has not been slaughtered properly) or pork, there is a difference of opinion among the scholars concerning that. According to the opinion that istihaalah is a means of purification (i.e., transformation of an impure, haraam substance into another, pure substance), there is nothing wrong with using them, because the haraam thing has turned into a different, permissible substance to which the evidence of prohibition does not apply.
Ibn al-Qayyim (may Allah have mercy on him) said:
Based on this principle, alcohol is impure, even though its origin is pure. If the reason for its being regarded as impure is no longer present (such as when wine turns into vinegar), then it is to be regarded as pure. This is the basis of sharee‘ah and the basis of reward and punishment.
Based on this, the correct analogy is that this principle may be applicable to all other impurities if they have gone through a process of change. The Prophet (peace and blessings of Allaah be upon him) removed the remains of the mushrikeen from the site of his mosque, but he did not remove the soil. And Allaah says of milk that it comes “from between excretions and blood” [al-Nahl 16:66]. The Muslims are unanimously agreed that if an animal eats impure things, but it is then detained and fed with pure things, its milk and meat become permissible. The same applies to crops and fruits: if they are watered with impure water, but are then watered with pure water, they become permissible, because of the change (istihaalah) in the impure thing, which becomes pure. The converse also applies: if the pure thing changes into something impure, then it becomes impure (naajis), like water, and food when it changes into urine and faeces. So how can the change affect it when good turns into bad, but not affect it when bad turns into good, and Allaah brings forth pure things from impure things and impure things from pure things?
It is not the origin of a thing that matters, but what it is now. It is impossible for the ruling on impurity to remain when the name and character of the thing have changed. The ruling is connected to the name and character, and is present or absent depending on whether they are present or absent. The texts which deal with the prohibition on dead meat, blood, pork and alcohol do not deal with crops, fruits, sand, salt, soil or vinegar, whether in wording or meaning or text or analogy.
Specialists have stated that gelatine derived from the bones and skins of cattle and pigs has been transformed completely from the substance from which it is derived, and has acquired chemical properties other than the properties of the original matter from which it is derived. This is what the scholars call istihaalah (transformation, process to change a substance to something else)).
See: Tahreem al-Intifaa‘ bi’l-A‘yaan al-Muharramah, p. 250-255.
In the statements of the Islamic Medical Sciences Organization, which discussed the topic of “Haram and impure substances in food and medicine” in partnership with al-Azhar, the Islamic Fiqh Council in Jeddah, the regional office of the World Health Organization in Alexandria and the Kuwaiti Ministry of Health during the period 22-24 Dhu’l-Hijjah 1415 AH/22-24 May 1995, it says:
Foods that contain lard (pork fat) in their list of ingredients, without it having been transformed (istihaalah), such as some cheeses, some types of oil, fat, ghee and butter, and some types of biscuits (cookies), chocolate and ice cream, are haraam and it is not permissible to eat them at all, because of the scholarly consensus that pigs are najis and it is not permissible to eat them, and because there is no compelling necessity to eat these foods.
Istihaalah, which means the turning of one substance into another that has different characteristics, is the transformation of an impure substance into a pure substance, or the transformation of a haraam substance into a substance that is permissible according to sharee‘ah.
Based on that:
Gelatine that is produced from the transformation of the bones, skin and sinews of impure (najis) animals is pure (taahir) and eating it is permissible.
Soap that is produced from the transformation of fat from pigs or animals that were not slaughtered in the Islamic manner (“dead meat”) becomes pure by means of that transformation, and it is permissible to use it.
Cheese that is made by using rennet from animals whose meat may be eaten but they were not slaughtered properly is pure (taahir) and it is permissible to consume it.
It is not permissible to use lotions, creams and cosmetic products that include lard (pork fat) in their list of ingredients, unless it is proven that the fat has been transformed and turned into something else. But if it is not proven, then they are impure (najis). End quote.
And Allah knows best.