Taking any material inside your body while fasting will invalidate your fast whether you take it with or with out water. If your doctors allow you to take the medicine after Iftar till Fajr, then you do so but if must take it during the day, then fasting will not be obligatory on you and you must then redo fasting when you are able to fast.
Wassalam.
Wassalam.