If you can take the medicine before Fajr and after Maghrib, and you will be okay with this change, then praise be to Allah.
If there is an injection that you can take instead of this medicine that can take its place, then consult your doctor about using it in Ramadan instead of the medicine, and there will be nothing wrong with you taking it whilst fasting.
If you must take the medicine during the day and changing the time will lead to great hardship or severe difficulty, then you are excused for not fasting and you should not fast, and you should make it up later on.
The majority of scholars are of the view that it is not permissible for a sick person not to fast in Ramadan unless his sickness is severe.
What is meant by severe sickness is:
1. The sickness will be made worse by fasting
2. Recovery will be delayed by fasting
3. He will encounter extreme hardship even if his sickness does not get worse or recovery is not delayed
4. The scholars added to this the one who fears that he will become sick because of fasting.
And Allah knows best.
Reproduced from Islam QA