All perfect praise be to The Lord of The Worlds, and may His blessings and peace be upon our Prophet Mohammad and upon all his family and companions.
Earlier jurisprudents defined illness that permits a patient to break obligatory fast as one which could lead to any of the following dangers in case he/she has observed fast after having undergone it:
1-Death
2-Loss of an organ`s function, such as becoming blind or mute.
3-Decrease in an organ`s function, such as incurring a weakness in sense of sight or smell.
4-Sudden illness or complications.
5-General leanness.
6-Slow recovery and long duration of illness, even without an increase in pain.
7-Hyperpain with no increase in the illness`s period, even if the illness was mild, such as headache, toothache or earache. If the patient feared an increase in pain, then he is permitted to break his fast.
8-Extreme deformity, such as overwhelming darkening of an external organ."{Moghni al-Mohtajj, 1/245} and {E`anat at-Talibeen, 2/267}.
In conclusion, if the doctor believes that fasting could subject his patient to any of the aforementioned dangers, then there is no harm in ordering him not to observe fast, take the medication and undergo the surgery. This includes patients suffering from "excessive obesity" mentioned in the above question. Therefore, if the doctor is of the view that these patients could suffer any of the above dangers due to delaying the surgery, or that delaying it means a delay in recovery, then there is no harm in performing "gastric bypass surgery" in Ramadan, even if it is imperative that they break their fast for the whole month since Sharia grants concessions to such category (patients) out of Allah`s mercy. He says in the Noble Quran{what means}:" Ramadhan is the (month) in which was sent down the Qur’an, as a guide to mankind, also clear (Signs) for guidance and judgment (Between right and wrong). So every one of you who is present (at his home) during that month should spend it in fasting, but if anyone is ill, or on a journey, the prescribed period (Should be made up) by days later. God intends every facility for you; He does not want to put to difficulties. (He wants you) to complete the prescribed period, and to glorify Him in that He has guided you; perchance ye shall be grateful."{Al-Baqarah/185}.
We beseech Allah, The Exalted, to reward us for investigating the right way to carry out different acts of worship and help us deliver the best of words and deeds. And Allah knows best.