It’s called Pikuach Nefesh (saving a life to override almost any commandment!).
Read tractate Yoma 84b: Here is one small tiny example:
תניא נמי הכי מחמין חמין לחולה בשבת בין להשקותו בין להברותו ולא שבת זו בלבד אמרו אלא לשבת אחרת ואין אומרים נמתין לו שמא יבריא אלא מחמין לו מיד מפני שספק נפשות דוחה את השבת ולא ספק שבת זו אלא אפי' ספק שבת אחרת
That was also taught in a baraita: One heats water for an ill person on Shabbat, whether to give him to drink or to wash him, since it might help him recover. And they did not say it is permitted to desecrate only the current Shabbat for him, but even a different, future Shabbat. And one must not say: Let us wait and perform this labor for him after Shabbat, perhaps he will get well in the meantime. Rather, one heats it for him immediately because any case of uncertainty concerning a life-threatening situation overrides Shabbat. And this is so not only with regard to uncertainty whether his life is in danger on the current Shabbat, but even in a case of uncertainty with regard to danger on a different Shabbat.
Here is an easy source to look up:
https://en.m.wikipedia.org/wiki/Pikuach_nefesh
I really hope you learn something and apologies for such a remark. Not for my sake but yours.