ד הַיּוֹצְאִים בְּשַׁיָּרָא בַּמִּדְבָּר, וְהַכֹּל יוֹדְעִים שֶׁהֵם צְרִיכִים לְחַלֵּל שַׁבָּת כִּי מִפְּנֵי הַסַכָּנָה לֹא יוּכְלוּ לְעַכֵּב בַּמִּדְבָּר בְּשַׁבָּת לְבַדָּם, ג' יָמִים קֹדֶם שַׁבָּת אֲסוּרִים לָצֵאת, וּבְיוֹם רִאשׁוֹן וּבְשֵׁנִי וּבִשְׁלִישִׁי מֻתָּר לָצֵאת, וְאִם אַחַר כָּךְ יְאֵרַע לוֹ סַכָּנָה וְיִצְטָרֵךְ לְחַלֵּל שַׁבָּת מִפְּנֵי פִּקּוּחַ נֶפֶשׁ, מֻתָּר, וְאֵין כָּאן חִלּוּל; וְהָעוֹלֶה לְאֶרֶץ יִשְׂרָאֵל, אִם נִזְדַּמְּנָה לוֹ שַׁיָּרָא אֲפִלּוּ בְּעֶרֶב שַׁבָּת, כֵּיוָן דִּדְבַר מִצְוָה הוּא, יָכוֹל לִפְרֹשׁ; וּפוֹסֵק עִמָּהֶם לִשְׁבֹּת, וְאִם אַחַר שֶׁיִּהְיוּ בַּמִּדְבָּר לֹא יִרְצוּ לִשְׁבֹּת עִמּוֹ, יָכוֹל לָלֶכֶת עִמָּהֶם חוּץ לַתְּחוּם, מִפְּנֵי פִּקּוּחַ נֶפֶשׁ; וְאִם נִכְנַס לְעִיר אַחַת בְּשַׁבָּת, מְהַלֵּךְ אֶת כֻּלָּהּ; וַאֲפִלּוּ הִנִּיחוּהוּ מִחוּץ לָעִיר וְרוֹצֶה לִכָּנֵס לָעִיר, מֻתָּר, דְּכֵיוָן דְּלִדְבַר מִצְוָה נְפַק יֵשׁ לוֹ אַלְפַּיִם אַמָּה לְכָל רוּחַ. הַגָּה: יֵשׁ אוֹמְרִים שֶׁכָּל מָקוֹם שֶׁאָדָם הוֹלֵךְ לִסְחוֹרָה אוֹ לִרְאוֹת פְּנֵי חֲבֵרוֹ חָשׁוּב הַכֹּל דְּבַר מִצְוָה וְאֵינוֹ חָשׁוּב דְּבַר הָרְשׁוּת, רַק כְּשֶׁהוֹלֵךְ לְטַיֵּל; וְעַל כֵּן נָהֲגוּ בִּקְצָת מְקוֹמוֹת לְהָקֵל בְּעִנְיַן הַפְלָגַת הַסְּפִינוֹת וַהֲלִיכַת שַׁיָּרָא תּוֹךְ שְׁלֹשָׁה יָמִים, כִּי חוֹשְׁבִים הַכֹּל לִדְבַר מִצְוָה; וְאֵין לִמְחוֹת בְּיָדָן, הוֹאִיל וְיֵשׁ לָהֶם עַל מִי שֶׁיִּסְמֹכוּ.
4 If one goes out on a caravan in the desert on Shabbat and everyone knows they will be required to violate Shabbat because of the danger - they cannot tarry in the desert on Shabbat by themselves - for three days prior to Shabbat it is forbidden to go (on this caravan). On Sunday, Monday and Tuesday it is permitted to embark on this journey. If afterwards danger should happen to him and he is required to violate Shabbat because of preservation of the soul it is permitted and it is not considered a violation. One who goes up to the Land of Israel to immigrate may go via caravan even on Erev Shabbat. How so? Because it is for a mitzvah. He is allowed to leave and stop with them for Shabbat. And if after he was in the desert they do not want to rest with him, he is permitted to go with them outside the Techum because of the preservation of the soul, פיקוח נפש. If they come to one city on Shabbat he can walk throughout the whole city. And even if they rest outside of the city and they desire to enter the city, it is permitted. Why? For a mitzvah. He is able to walk 2000 amot in all directions. Rema: There are those who say that every place a person goes for commerce, or to see a friend, it is considered the same as traveling for a matter of a mitzvah, but it is not considered for personal concerns except when he goes out for a stroll. Therefore it is the custom in a few places to be lenient regarding travelling by ship and going out on a caravan within three days because everything is considered like traveling for the sake of a mitzvah, and we do not object to this since there is one upon whom they can rely.