874. Leaving the Four-Cubit Limit
Shabbos 27:15
Let's say that a person who has become limited to four cubits needs to answer the call of nature. In such a case, he may leave the four cubits in order to go wherever necessary to relieve himself. He must then return to his place. If moving away to answer nature's call causes a person to re-enter the Shabbos boundary he had left, then since he has entered, it is as if he never left. This leniency only applies to one who left his Shabbos boundary unintentionally. One who left his Shabbos boundary intentionally is limited to four cubits even if he reenters.
Shabbos 27:16
If someone leaves the Shabbos boundary permissibly, such as the witnesses who travel to testify about seeing the moon and others who are so permitted for the purposes of a mitzvah, once they have reached their destination, they are permitted to travel 2,000 cubits in each direction. If they find themselves in a city, they are just like the residents of that city and may travel 2,000 cubits beyond the city in any direction.