The Mishnah discusses exemptions to the Shabbat travel limitation:
ALL WHO GO OUT (beyond the Shabbat limit) [IN ORDER] TO SAVE LIFE MAY RETURN TO THEIR ORIGINAL PLACES.
Exemptions to the 2000 cubit travel limit on Shabbat are given for those performing a religious function. For example, if one were traveling to Jerusalem to give evidence of a New Moon. But a greater exemption is given to those whose mission is saving lives. For example a midwife, or workers rescuing people from a fire. Not only are they allowed to travel, but they are treated as if they are "local" in the town and given the full ability to travel within it.
But does this Mishnah imply that they can travel back even beyond the 2000 cubit limit in order to "return to their original places"?
Rab Judah replied in the name of Rab:The meaning Is that they MAY RETURN TO THEIR ORIGINAL PLACES with their weapons; as it was taught: At first they used to leave their weapons in a house that was nearest to the town wall. Once it happened that the enemies recognized them and pursued them, and as these entered the house to take up their weapons the enemies followed them. There was a stampede and the men who killed one another were more than those whom the enemies killed. At that time it was ordained that men in such circumstances shall return to their places with their weapons.
Special exemption is giving to the volunteer militia, given the responsibility to protect the town. This leads to a very interesting conversation about the use of power:
Rab Judah stated in the name of Rab: If foreigners besieged Israelite towns it is not permitted to sally forth against them or to desecrate the Sabbath in any other way on their account.
This, however, applies only where they came for the sake of money matters, but if they came with the intention of taking lives the people are permitted to sally forth against them with their weapons and to desecrate the Sabbath on their account.
Where the attack, however, was made on a town that was close to a frontier, even though they did not come with any intention of taking lives but merely to plunder straw or stubble, the people are permitted to sally forth against them with their weapons and to desecrate the Sabbath on their account.
The responsibility to protect the lives of innocents is clear. But sometimes the responsibility extends to national protection. When one lives near the frontier, the duty includes protection against foreign invasion.