The Gemara comments in Masechet Yoma that when a person´s life is in danger, Heaven forbid, Shabbat is to be violated in order to save him. The Gemara derives this halacha from the pasuk that states regarding the mitzvot, “va´chai bahem,” or “and one shall live through them,” implying that one should not risk his life for mitzvot – “va´chai bahem, ve´lo she´yamut bahem.” The Torah was given to us from God, through Moshe, in order that we live according to its laws; Torah observance must not lead to death. (There are, of course, several exceptions to this rule, namely, the three sins of idolatry, adultery and murder, regarding which there is an obligation of “kiddush Hashem,” to die rather than transgress. Additionally, an obligation of “kiddush Hashem” exists regarding other mitzvot, as well, under circumstances of “shemad,” or religious persecution. A comprehensive discussion of this topic lies beyond the scope of our discussion.)
Thus, the prohibitions of Shabbat must not endanger one´s life, Heaven forbid.
When such a situation occurs, one should not take the time to consult with a rabbi. Rather, everyone should already be proficient in these laws so that he knows when he may desecrate the Shabbat. Chazal stated very harshly that whoever goes to ask a halachic question in these situations “is considered as having shed blood.” Instead of taking the time to ask, one must immediately lend assistance to the patient. (Obviously, we refer to situations that are clearly life-threatening.)
The Yerushalmi comments that the rabbi who is consulted under such circumstances is likewise worthy of condemnation. The poskim learn from here that every rabbi must teach his community of the obligation of, and the laws relevant to, violating Shabbat in life-threatening situations.
If one desecrated Shabbat to save a life and his actions turned out to have been unnecessary – such as if the patient was cured or someone else managed to save him – or futile – e.g. the patient did not survive, God forbid, he has nevertheless fulfilled a mitzva and will receive reward for his efforts to save a Jewish life.
May we never know of such situations.