Despite the unique importance of Shabbat observance, which is one of the most foundational Misvot in the Torah, it does not override the concern for human life. Only the three prohibitions of murder, idolatry, and sexual immorality must be avoided even at the expense of human life. All other Misvot, including Shabbat observance, are waived for the sake of protecting human life when necessary. Therefore, when a person faces life-threatening danger on Shabbat, and protecting his life requires Shabbat desecration, it is not only permissible, but a vitally important Misva, to do whatever is necessary to protect his life, even if this entails Shabbat desecration. The Shulhan Aruch (Orah Haim 328) rules that in such a situation one should not even take the time to consult with a Rabbi for guidance, as the delay might put the patient at greater risk.
There is a fundamental dispute among the Rishonim (Medieval Halachic scholars) as to the extent of the suspension of the Shabbat prohibitions in situations of life-threatening danger. The Rosh (Rabbenu Asher Ben Yehiel, Germany-Spain, 1250-1327) cites his mentor, the Maharam Me’Rutenberg (1215-1293), as claiming that when somebody’s life is in danger, Shabbat is "Hutra" (literally, "permissible"), meaning, entirely suspended as far as caring for that person is concerned. Accordingly, anything may be done for the patient without any hesitation and without any regard for the Shabbat laws. The Rosh draws a comparison to cooking on Yom Tob, which is entirely permissible. It is allowed not as a special leniency in light of the situation, such that the cooking must be kept to a minimum, but is rather fully allowed. Likewise, according to the Rosh, when somebody’s life is in danger, the Shabbat restrictions are entirely lifted, and there are no restrictions by which one is bound.
The Rambam (Rabbi Moshe Maimonides, Spain-Egypt, 1135-1204), however, implies otherwise. He writes (Hilchot Shabbat 2:1) that in the case of a risk to life, Shabbat is "Dehuya" – which literally means, "pushed away." This has been understood as indicating that in the Rambam’s view, the Shabbat prohibitions remain intact even in the case of a risk to life, and one must violate only what is necessary to protect the person at risk. This would mean that one would have to try to minimize the extent of his Shabbat desecration in such a case as much as possible, such as by violating Rabbinic prohibitions instead of Biblical prohibitions when this is possible without endangering the patient.
There is considerable discussion among the later Halachic authorities as to which position is accepted. For example, this issue is discussed at length by the Aruch Ha’shulhan (Rav Yechiel Michel Epstein of Nevarduk, 1829-1908), in the beginning of Siman 328, where he brings and analyzes different proofs to both positions. Rabbi Moshe Ha’levi (Israel, 1961-2000) addresses this question at length in his Menuhat Ahaba (vol. 1, 21:6), and concludes (listen to recording for precise citation) that the consensus seems to follow the second view cited above, that the Shabbat prohibitions are "Dehuya." Besides being the implication of the Rambam, as noted above, this is also the position taken by numerous other Rishonim, as Rabbi Moshe Ha’levi demonstrates. (These include the Eshkol, the Rashba, the Ra’abad, the Yere’im, the Or Zarua and the Rikanti.) On this basis, Rav Moshe Ha’levi rules that one must make every effort to minimize Shabbat desecration when tending to life-threatening situations. Thus, for example, medical personnel who anticipate having to attend to emergencies on Shabbat should prepare whatever they can before Shabbat so as to minimize Shabbat desecration. Another example is performing forbidden activities with a "Shinui," meaning, in an unusual manner, such as using one’s left hand instead of his right hand. This relegates the act to the level of a Rabbinic violation, as on the level of Torah law, Shabbat is violated only if one performs the forbidden action in its usual manner. Therefore, when Shabbat must be violated for the sake of preserving human life, one must, when possible, perform the act in an unusual manner.
However, Rav Moshe Ha’levi strongly emphasizes that this applies only if minimizing the extent of Shabbat desecration will have no impact whatsoever on the outcome, and will not pose any additional risk. If, however, this would result in any sort of delay in the treatment of the ill patient, then one should do whatever is necessary to care for the patient swiftly and adequately without any concern for the Shabbat laws. It is only if the speed and quality of care will not be compromised to even the slightest degree that Halacha requires minimizing the extent of the Shabbat desecration.
Summary: In the case of a life-threatening situation on Shabbat, one must do whatever is necessary to care for the person in danger, even at the expense of the Shabbat laws. However, one should try to minimize the extent of the Shabbat desecration, such as by performing the necessary actions in an unusual manner (for example, with one’s left hand, instead of the right), provided that this is no way hinders the efforts to save the person whose life is threatened.