Like so many things in our faith, the answer to this question is nuanced and based on context. Why medicine is taken and how it is taken both factor into the answer.
An inhaler for an asthmatic or an insulin shot for a diabetic are both fine because neither are being “eaten,” nor are they replacements for food or drink.
For medicine that is taken orally though, or medicine that replaces food or drink [like an IV] the answer differs and refers back to the mercy of Allah in His concessions upon fasting for the ill.
Can I take medication during fasting?
This question is in regards to taking medication during fasting. The answer to this is that it depends what kind of medication the person's talking about. Certain medication you can take it while you're fasting, like for example the insulin shot, or the inhaler for those who have asthma, or maybe a shot in your muscles that you need. As long as this shot that you take is not a vitamin shot, or you don't have an IV, which is basically a replacement for food and drink.
Also, you cannot take pills while you're fasting. If you take a pill while you fast, that will break your fast by the consensus of the Muslim scholars. But if you are sick and you need the medication, have high blood pressure or you're diabetic and you need to take pills, in this case, alhumdulilah, Allah SWT gives you permission to break your fast and if you're expecting to recover from this sickness later on, you can make up these days later on. And if this sickness is something you don't think you'll be recovering from it, you can feed a meal for each day that you break your fast because of it.
Allah knows best and may Allah guide all of us to what is correct.