Rabbi Elazar ben Azarya answered and said: Just as the mitzva of circumcision, which rectifies only one of the 248 limbs of the body, overrides Shabbat, so too, a fortiori, saving one’s whole body, which is entirely involved in mitzvot, overrides Shabbat. Other tanna’im debated this same issue.
Rabbi Yosei, son of Rabbi Yehuda, says that it is stated: “But keep my Shabbatot” (Exodus 31:13). One might have thought that this applies to everyone in all circumstances; therefore, the verse states “but,” a term that restricts and qualifies. It implies that there are circumstances where one must keep Shabbat and circumstances where one must desecrate it, i.e., to save a life.
Rabbi Yonatan ben Yosef says that it is stated: “For it is sacred to you” (Exodus 31:14). This implies that Shabbat is given into your hands, and you are not given to it to die on account of Shabbat.
Rabbi Shimon ben Menasya said: It is stated: “And the children of Israel shall keep Shabbat, to observe Shabbat” (Exodus 31:16).The Torah said: Desecrate one Shabbat on his behalf so he will observe many Shabbatot. Rav Yehuda said that Shmuel said: If I would have been there among those Sages who debated this question, I would have said that my proof is preferable to theirs, as it states: “You shall keep My statutes and My ordinances, which a person shall do and live by them” (Leviticus 18:5), and not that he should die by them.