Food Cooked In Wine
Yes, this can be understood through a simple Islamic principle: necessity changes the ruling. Islam even allows normally haram food if a person is at risk of starvation and no halal option is available, only to the extent needed to survive. This does not make the haram thing permissible in itself, but it shows that preserving life comes first. The same logic applies to medicine. Medicine is taken for treatment, not enjoyment, and alcohol in it is often used only as a solvent or preservative, not to intoxicate. Because medicines are taken in measured doses, for a limited time, and with the intention of healing, they do not carry the same risk of normalization or addiction as food or drink. A common example is cough syrup, which may contain a small amount of alcohol to keep the medicine effective; when taken as prescribed, it does not intoxicate and is stopped once the illness ends.