Allaah says (interpretation of the meaning):
“So whoever of you sights (the crescent on the first night of) the month (of Ramadan i.e. is present at his home), he must observe Sawm (fasts) that month, and whoever is ill or on a journey, the same number [of days which one did not observe Sawm (fasts) must be made up] from other days”
i.e., if a person is physically sick and it is too hard for him to fast or he will be harmed by fasting, or he is travelling, he is allowed not to fast, but he has to make up the number of days that he did not fast. Hence Allaah says (interpretation of the meaning): “Allaah intends for you ease, and He does not want to make things difficult for you” [al-Baqarah 2:185]. The scholars have stated that if a trustworthy Muslim doctor states that fasting will be harmful to a sick person, or will make his sickness worse or delay his recovery and the like, then not fasting in this case is permissible according to sharee’ah. If the doctor is not Muslim, or he is Muslim but he is not of good character, then his opinion should not be accepted except in cases of necessity, such as if it is not possible to ask another doctor. If it is a necessity and other factors indicate that the non-Muslim is telling the truth, such as if the sick person feels the same thing, or it is well known that this sickness is something that gets worse with fasting and that will make recovery difficult, then in that case it is permissible not to fast until Allaah heals him and he becomes strong enough to fast without adverse effects.
With regard to the past months, you have to make them up after you recover, and there is no expiation for delaying it, because you did not make them up because you were still sick. End quote.