The prohibitions of Shabbat apply only on Shabbat. Accordingly, at first glance it would seem permissible to go on a dangerous trip on Friday, keep traveling until a minute before Shabbat, and then when Shabbat begins, decide that one is in a dangerous place. Since danger to life supersedes Shabbat, in order to save himself from danger he would have no choice but to continue traveling to the nearest inhabited area. It is true that if one finds himself in a dangerous place on Shabbat, he may desecrate Shabbat in order to save himself. But a Jew may not put himself in a situation that will require him to desecrate Shabbat. The Sages tell us that starting from Wednesday a Jew must plan things in a way that will not cause him to desecrate Shabbat.
Therefore, from Wednesday onward the Sages forbade people from setting sail on a boat for recreational purposes, and this prohibition applies even when the crew members are non-Jews (Shabbat 19a). There are several reasons for this: first, there is the concern that a dangerous situation will arise and the Jew will have to engage in prohibited activities to help steer the boat (Ha-ma’or). Second, even if there is no chance that the sailors will request his help, if half of the passengers are Jewish then the sailors are working for them on Shabbat, and it is rabbinically prohibited for a Jew to benefit from work that a non-Jew undertook on his behalf on Shabbat (Ramban). Furthermore, even when most of the passengers are non-Jews, if the boat is traveling in shallow water where fewer than ten tefaĥim (handbreadths; each tefaĥ is 7.6 cm) separate the boat from the ocean floor, the Jews are violating the prohibition of being outside teĥum Shabbat (Rabbeinu Ĥananel; see ch. 30 below for the definition). Even if the boat will be sailing in deep water or will be anchored on Shabbat in the middle of the ocean, there may still be a prohibition: since many who travel on boats suffer from seasickness in the first days, the voyage negates the mitzva of oneg Shabbat (Rif).
But in a situation where none of these reasons are relevant – where the sailors and the majority of the passengers are non-Jewish, there is no chance they will ask Jews for help, they are sailing in deep water, and the boat is large and stable so seasickness is unlikely and he will be able to enjoy Shabbat – in such a case one may set sail, even one minute before Shabbat begins, and even if the trip is recreational.
On the first three days of the week, one may set sail for recreational purposes even if it is possible that when Shabbat arrives one may be faced with the necessity of transgressing. This is because on those days, one is not required to limit his actions for fear of desecrating Shabbat or negating the mitzva of oneg Shabbat (but if it is clear that he will definitely need to desecrate Shabbat, then according to Ha-ma’or, Rivash, and Shulĥan Arukh [248:4] one may set out at the beginning of the week, whereas according to Mahari b. Lev and Radbaz it is forbidden. See n. 7).
It should also be noted that the Rishonim disagree whether the prohibition of setting sail is in force three days before Shabbat, i.e., from Wednesday (starting on Tuesday at night, which is the start of the halakhic day), or if it applies from Thursday (with Shabbat being included as one of the last three days of the week). See Beit Yosef §248 and MB 248:4. The answer to this question depends on the reason for the prohibition. If the fear is that one will desecrate Shabbat either by performing a melakha himself or by having a non-Jewish sailor do it for him, or alternatively if the concern is for teĥum Shabbat, these prohibitions all go into effect from Wednesday through Friday since these three days are referred to as “before Shabbat” (Gittin 77a). During this period he must not do anything that will lead him to desecrate Shabbat later on. However, if the concern is for oneg Shabbat, that is relevant only from Thursday; several of the Rishonim who mention this concern (including Rosh) specify that the prohibition of setting sail goes into effect on Thursday, because by the journey’s third day the passenger is already used to the water and can still enjoy Shabbat. See Menuĥat Ahava, 1:1:2.
It is also important to note that the condition that most of the passengers be non-Jews is relevant only to a boat whose departure depends upon a certain number of places having been reserved. However, if the boat has a set schedule and does not depend on the number of passengers, then even if by chance most of the passengers are Jews, one may set sail during the three days before Shabbat, since the non-Jewish sailors would sail even if there were no Jews aboard (SSK 30:66).