The Rambam (Hilchos Ta’anis 1:3) rules that the obligation to observe a Ta’anis Tzibur (public fast) is a Mitzvas Aseh (affirmative commandment) of the Chachamim and an institution of the Nevi’im. However, that obligation only applies when the Jewish people do not live in peaceful times. The Gemara (Rosh Hashana 18b) explains that when the Jewish people do live in peace, “if they want, they can observe the fast, but if they don’t want, they needn’t observe it”. Nonetheless, the observance of Tisha b’Av is always obligatory, even during times of peace.
There is a dispute among the Rishonim and Acharonim as to whether we currently live in “times of peace” or not. Some hold that we do live in times of peace and therefore our observance of public fast days is only a Minhag. Others maintain that we do not live in times of peace and therefore we are obligated to fast by the institution of the Nevi’im.
The Netziv (Ha’amek Sha’ala) maintains that even if our observance of public fast days is obligatory and not merely a Minhag, the obligation is still not equivalent to the obligation to observe Tisha b’Av. Rather, our obligation stems from the Jewish people’s complete and total acceptance of a Minhag. This is quite unlike Tisha b’Av which has always been a real obligation that was instituted by the Nevi’im.
Some argue that even those who hold that our observance of public fast days is a Minhag would agree that this Minhag is stronger than other Minhagim (such as avoiding Kitniyos on Pesach). In this instance, the observance of the Minhag is an actual fulfillment of the original institution of the Nevi’im.
While Tisha b’Av is generally treated more strictly than the other public fasts, when it is Nidcheh it is viewed more leniently than when it is observed on the 9th of Av. For example, although pregnant or nursing women who are obligated to fast on a regular Tisha b’Av, they are exempt when it is Nidcheh – just as they are on the other fasts (such as the 17th of Tamuz).
Rav Shlomo Zalman Auerbach zt”l rules that on other fasts (aside from a normal Tisha b’Av), medical staff who feel that the fast would impact the quality of their work are exempt from fasting just like the sick patients they treat. Certainly, when they are involved in cases of Pikuach Nefesh, where even the slightest danger sets aside all Halachos of the Torah, they should not be stringent.
Obviously, every medical practitioner should carefully assess whether the quality of his treatment will suffer from fasting. For example, a primary care physician seeing routine patients in clinic during the morning hours of a fast should probably not be lenient. Similarly, somebody who is easily able to switch his shift to another day (or one following the fast) would be advised to do so rather than being lenient and not fasting. Rav Shlomo Zalman’s ruling applies to hospital staff who cannot switch their shifts and therefore need to assess whether they will be able to perform their duties adequately while fasting.
What about a doctor who is not actually on duty but is on-call and would come into the hospital if he is needed? If observing the fast would affect his performance, is he exempt because of the possibility that he may have to work?
Perhaps there is a proof from the law of the Kohanim who were waiting in reserve to serve in the Beis Hamikdash. The Kohanim were divided into Mishmaros (groups) and each Mishmar contained a number of families who would take turns in performing the Avodah. When it wasn’t their turn to serve, other members of the Mishmar would be on standby, to provide extra help if needed.
The Mishna (Ta’anis 15b) says that the entire Mishmar was exempt from fasting on public fast day, even those who weren’t scheduled to perform the Avodah that day. Rashi explains that the other members of the Mishmar may have been called upon to help the family whose turn it was to serve that day. They needed to feel strong and well and were not permitted to fast.
Perhaps the same reasoning could be applied to on-call medical staff. As their services might actually be required, they could be viewed as integral members of the hospital staff team and, therefore, should also be exempt from fasting. Of course, this is a novel ruling and a Rav should be consulted for Halacha l’Maaseh.
 I.e. the Minhag is to fulfill the Mitzvah of the Nevi’im by observing the fast
 Shevus Ya’akov (3:37)
 Cited in מדריך הלכתי לאחיות בבתי חולים לשבתות וחגים – “The Halachic Handbook for Hospital Nurses on Shabbos and Yom Tov”
 However, there must be a reasonable likelihood that they will be involved in cases of Pikuach Nefesh.