The Shulhan Aruch (Orah Haim 329) addresses the case of a collapsed building on Shabbat, Heaven forbid, and it is suspected that there are people buried in the rubble. It goes without saying that the rescuers must do anything they can to save the victims, and their efforts override the Shabbat prohibitions. The Shulhan Aruch writes that if the rescuers find a person in the rubble who is not moving, and they are uncertain whether the victim is alive, they should place a feather underneath his nostrils to see if it moves. If it does, then they know the patient is still alive, and the rescuers must do everything possible to help him. If the feather does not move, then the patient is presumed dead, and Shabbat may not be violated to retrieve his body from the rubble. The work to retrieve the body should be delayed until after Shabbat, because the Shabbat prohibitions are suspended for the purpose of saving a life, but not for lifting a corpse, Heaven forbid, from rubble.
However, Hacham Ovadia Yosef writes that this provision does not apply in today’s day and age, when modern medicine has come up with effective means of resuscitation. Even after a patient stops breathing, medics and physicians are able, in some situations, to resuscitate him and restore breathing. Therefore, if a patient stops breathing on Shabbat, Heaven forbid, the Shabbat prohibitions may still be violated in order to resuscitate him and treat him, until he is pronounced dead.
Significantly, Hacham Ovadia emphasizes that this applies even if the professionals figure that the patient will live for only a few minutes after resuscitation. Halacha treats "Hayeh Sha’a" – temporary life – with the same level of severity as life which can be restored for many years to come. The Torah views every moment of life as incalculably precious, and therefore, as important as Shabbat observance is, it is overridden by the effort to prolong a person’s life even for a few minutes. As long as the rescuers or medical professionals figure that there is a chance of prolonging a victim’s life even very briefly, they are allowed and in fact required to do everything necessary to do so, even if this entails violating the Shabbat laws.
Summary: A patient who is not breathing, Heaven forbid, on Shabbat may be resuscitated and treated as long as there is a chance of reviving him and prolonging his life, even for just several minutes.