It depends
The Prophet ﷺ said of wine: it is not a medicine but a disease. Many contemporary scholars, however, allow medicines in which alcohol is only a solvent in a small, non-intoxicating amount – especially if there is no alternative.
Source: Sahih Muslim 1984