It is not permissible to make medicine in this manner, because it involves using wine or alcohol, and Allah has commanded us to avoid alcohol, as He says (interpretation of the meaning):
“So avoid (strictly all) that (abomination) in order that you may be successful”
And the Prophet (blessings and peace of Allah be upon him) forbade making medicine from wine and he said that wine is a disease and is not a remedy.
Muslim (1984) narrated that Taariq ibn Suwayd al-Ju‘fi (may Allah be pleased with him) asked the Prophet (blessings and peace of Allah be upon him) about wine and he forbade him or expressed his disapproval of his making it. He said: I only make it as a remedy. He said: “It is not a remedy; rather it is a disease.”
An-Nawawi (may Allah have mercy on him) said:
This indicates that it is haraam to store alcohol [i.e., to keep it] and to make it into vinegar, and it is a clear statement that it is not a remedy and it is haraam to use it for medicinal purposes.
For more information, please see the answer to question no. 41760
But… If the medicine has been manufactured in this haraam manner, it is permissible to use it if the alcohol has been absorbed into this medicine and there is no trace of it left in the form of colour, taste or smell.
But if there is still some trace of it in the medicine, it is not permissible to use it, because using it constitutes using and consuming alcohol.
Al-Bahooti (may Allah have mercy on him) said:
If the intoxicant is mixed with water and is absorbed into it then he drinks it, the hadd punishment is not to be carried out on him, because by being absorbed into the water, it did not change the nature of the water.
End quote from Kashshaaf al-Qinaa‘, 6/118
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
If alcohol falls into water and is absorbed, then someone drinks it, he is not drinking alcohol and he does not have to be given the hadd punishment for drinking alcohol, if nothing of its taste, colour or smell remained. If a woman’s milk is poured into water and is absorbed to the extent that no trace of it is left, and a child drinks that water, he does not become her son through breastfeeding thereby.
End quote from Majmoo‘ al-Fataawa, 21/33
The scholars of the Standing Committee for Issuing Fatwas said:
It is not permissible to mix medicines with alcohol, but if it has been mixed with alcohol it is permissible to use it if the ratio of alcohol is low and its traces do not appear in the colour, taste or smell of the medicine. Otherwise it is haraam to use anything that has been mixed with it.
End quote from Fataawa al-Lajnah ad-Daa’imah, 25/39
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
Alcohol is an intoxicating substance as is well known, so it is khamr, because the Prophet (blessings and peace of Allah be upon him) said: “Every intoxicant is haraam,” and according to one report he said, “Every intoxicant is khamr.”
Based on that, if this alcohol is mixed with something and was not absorbed into the substance it was mixed with, then this mixture becomes haraam, because this mixture still has a trace of alcohol. But if this alcohol has been absorbed into what it is mixed with and no trace of it appears, then it is not haraam.
End quote from Fataawa Noor ‘ala ad-Darb, 122/21
He also said:
With regard to the mixing of some medicines with a small amount of alcohol, that does not necessarily mean that they are haraam, if the alcohol in the mixture is very little and no trace of it remains with what it has been mixed with.
End quote from Majmoo‘ Fataawa wa Rasaa’il Ibn ‘Uthaymeen, 11/193
And Allah knows best.