All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
Anesthesia does not invalidate fasting unless it lasts for the whole day. The patient and physician are not considered sinful for this. However, it is preferable to avoid this during the day and perform it at night if possible. Surgical operations outside the abdomen do not affect fasting. Nevertheless, if it is in the abdomen, it is safer to delay it until night if possible so as not to be caught up in the differences among jurists who say that fasting is invalidated if something reaches the stomach.
Allaah Knows best.