I.
The person who has a condition from which there is no hope that he will recover, and it is difficult for him to fast or he has to take medicine during the day, is allowed not to fast and must pay the fidyah (penalty).
An-Nawawi (may Allah have mercy on him) said: Ash-Shafa`i and our companions said: The old man who finds it difficult to fast, meaning that he suffers extreme hardship if he does fast, and the sick person for whom there is no hope of recovery are not obliged to fast, and there is no difference of scholarly opinion regarding that; Ibn al-Mundhir narrated that there was consensus on that. But they must pay the fidyah according to the more sound of the two scholarly views.
End quote from Al-Majmu`, 6/285.
So if you did not suffer real hardship when fasting, and you only did not fast so that you could take medicine, and if the day in your city lasts for more than twelve hours, then there is no blame on you for what you used to do of not fasting and paying the fidyah. But if the day is not longer than twelve hours, and you did not fast, then you did wrong and you must make up the days when you did not fast.
II.
If Allah heals you, or you become able to do without the medicine, or you take a different medicine that does not conflict with fasting, then you must fast, but you do not have to do anything regarding the past according to the details that we have mentioned.
It says in Al-Mubdi`, 3/13: If he fed the poor [instead of fasting], then he became able to make up the fasts, he is like one who was incapacitated and Hajj was done on his behalf, then he recovered. This was stated by al-Majd. What appears to be the case is that he does not have to make up the missed fasts; rather he is required to feed the poor. End quote.
Al-Bahuti said, after quoting this: What it means is that if he recovers before feeding the poor, then he must make up the missed fasts.
End quote from Kashshaf al-Qina`, 2/310.
What this means is that if you used to feed the poor, then you do not have to make up the fasts, but if you did not feed the poor, then you must make up the fasts.
An-Nawawi said: If an old man who is incapable or a sick person for whom there is no hope of recovery does not fast, then he becomes able to fast, is he obliged to make up the missed fasts? There are two views concerning that, both of which were narrated by ad-Darimi.
Al-Baghawi said: Al-Qadi Husayn narrated that he does not have to make it up, because he was not required to fast; rather he was required to pay the fidyah, in contrast to one who is incapacitated, and he delegates someone to do Hajj on his behalf, then he becomes able to do it. In that case he is obliged to do Hajj according to the more correct of the two scholarly views, because he was required to do it.
Then al-Baghawi favoured the view that if he becomes able to fast before he pays any fidyah, then he must make up the fast. But if he becomes able to fast after paying the fidyah, then it may be that the matter is similar to Hajj [that is, he is still required to make up the missed fasts], because he was obliged to pay the fidyah based on the assumption that his excuse would continue, but now it has become clear that that is not the case. And Allah knows best.
End quote from Al-Majmu`, 6/259.
The correct view is both cases is that he does not have to make up either.
Shaykh Zakariyya al-Ansari (mam him) said in Sharh al-Manhaj: One mudd [of staple food] must be given for every day, with no need to make up the missed fast, by one who did not fast on that day because of an excuse for which there is no hope that it will cease to apply, such as old age and sickness for which there is no hope of recovery, because of the verse {For those who can fast only with extreme difficulty} [al-Baqarah 2:184]. What is meant is that they are not able to fast, or they are able to fast when young, then they become unable to fast when they grow old.
Al-Jamal said in his commentary on that: In principle one mudd must be given, so even if the excuse ceases to apply before paying the fidyah, he is not obliged to make up the missed fasts; rather he should pay the fidyah. But if he fasts, then he does not have to pay the fidyah…
And if he gave the mudd, then became able to fast after having not fasted, he does not have to make up the missed fasts.
End quote from Hashiyat al-Jamal, 2/339.
We ask Allah to heal you and grant you well-being.
And Allah knows best.