One need not forgo his Shabbat rest or anything else that is dear to him in order to minimize the Shabbat desecration of another person who is involved in lifesaving activities. In addition, there is a concern that if one is forced to forgo something dear to him, he will hesitate to do what is needed to remove a hazard. For example, if one sees fallen electrical wires that are exposed and deadly, he could theoretically stand there for all of Shabbat in order to warn passersby not to touch the wires. Nevertheless, if this is difficult for him – e.g., if Shabbat will not be over for hours – he may alert the electric company, which will send repairmen to fix the wires on Shabbat (R. Shlomo Zalman Auerbach, cited in SSK 41:21; Tzitz Eliezer 8:15:11:7).
If a gravely ill person’s home is so cold that it endangers his life, a neighbor whose home is heated need not be asked to inconvenience himself by taking in the sick person. Rather, the heat may be turned on in the sick person’s home, as saving a life overrides Shabbat. Even if the neighbor is asked to take in the sick person, he is not required to do so (based on the ruling of R. Shlomo Zalman Auerbach in SSK ch. 32 n. 174; he derives this from the rule that one need not forgo his property and may confront a burglar even if the results may be lethal).
Similarly, a soldier on guard duty need not volunteer to do an extra shift in order to prevent his replacement from traveling on Shabbat. Since one may travel on Shabbat in order to perform guard duty, the first guard does not have to forfeit his rest in order to prevent this travel.
If soldiers need to travel in tanks for a security mission but will destroy the eruv if they take the shortest possible route, they should take a longer route, unless all of the eruv’s beneficiaries agree to let it be destroyed. This is because the eruv’s beneficiaries do not have to forfeit their benefit just so that the tank driver can minimize driving on Shabbat. Similarly, one who is driving a patient to the hospital should not barrel through private or public gardens, even when that is the shortest route to the hospital. Rather, the driver must go around, because neither the individual nor the community is obligated to forfeit its gardens so that someone involved in life-saving travel can minimize his Shabbat desecration (R. Shlomo Zalman Auerbach, as cited in Ha-tzava Ka-halakha 26:4-7; see there for the dissenting opinion as well).