WHY ONE MAY NOT EMBARK ON A SHIP BEFORE SHABBOS [Shabbos: on a boat]
Gemara
19a (Beraisa): One may not embark on a ship less than three days before Shabbos.
This refers to a voyage of Reshus, but it is permitted for a Mitzvah.
Rebbi says, he must stipulate with the captain that they will not travel on Shabbos. [Later,] we are not concerned if they actually do travel on Shabbos;
R. Shimon ben Gamliel says, he need not stipulate.
One may go from Tzur to Tzidon even on Erev Shabbos. (The voyage takes only one day.)
(Beraisa): We may not begin a siege around a Nochri city less than three days before Shabbos.
98a (Rav): One who carries four Amos in a Reshus ha'Rabim with a ceiling is exempt, for this is not like the encampment in the Midbar.
Eruvin 43a - Question (Rav Chananyah): Does the Isur of Techumim apply more than 10 Tefachim above the ground?
This applies [also] to going in a boat. (It is normally 10 Tefachim above the sea floor.
Answer (Mishnah): Once, the boat did not enter the port until Shabbos [...R. Gamliel permitted to get off, for it was within the Techum before dark].
If there is no Isur Techumim above 10, it would be permitted to get off even if it was not in the Techum before dark!
Rejection (Rava): The case is, the boat was in shallow water.
Gitin 77a (R. Zeira): The three days after Shabbos are considered after Shabbos. The three days before the coming Shabbos are considered before Shabbos.
Rishonim
Rif and Rosh (7b and 1:38): Some say that the Isur to embark less than three days before Shabbos is when the boat scrapes the ground and the water is less than 10 Tefachim deep, due to the decree of Techumim. If it is above 10 Tefachim, Chachamim did not decree. This is why the custom is to embark on the Yam ha'Gadol. This is wrong. If this were the reason, Chazal should have taught 'one may not embark on a small ship.' Why did they teach a Stam ship, which connotes big or small? Also, why does it depend on three days? It should be forbidden even before this! Also, why is it permitted for a Mitzvah? Chachamim upheld their laws even when it entails neglect of a Mitzvas Aseh, e.g. an Onen may immerse and eat Korban Pesach at night, but he may not eat other Kodshim at night (Pesachim 91b). Rather, it is forbidden less than three days before Shabbos due to Bitul Oneg Shabbos. For three days, this is a change in his Veses (normal state) from the movement of the ship - "Yachogu v'Yanu'u ka'Shikor", and he cannot fulfill Oneg Shabbos. We permit due to a Mitzvah, for he is exempt from Oneg, since one engaged in a Mitzvah is exempt from [another] Mitzvah; people on the way to a Mitzvah are exempt from Sukah (Sukah 25a). Likewise, one may not travel more than 12 Mil on Erev Shabbos (Sukah 44a) due to Bitul Oneg Shabbos. This is why we do not begin a siege around a Nochri city less than three days before Shabbos, due to exertion. One will not enjoy the food and drink due to exertion and fear. The fear does not leave until three days. Then, he can fulfill Oneg Shabbos.
Rambam (Hilchos Shabbos 30:13): We may not begin a siege around a Nochri city less than three days before Shabbos, so the soldiers' minds will be settled and they will not be confounded and distracted on Shabbos. This is why one may not embark on a sea voyage less than three days before Shabbos, so his mind will be settled before Shabbos and he will not be pained too much.
Magid Mishneh: The Ge'onim argue about the reason. The Rambam forbids due to Bitul Oneg Shabbos, like the Rif. Therefore, he wrote in a Teshuvah that only salty seas are forbidden, due to the pain and nausea. It is permitted on rivers.
Teshuvas ha'Rambam (310): There is no Isur mid'Oraisa of Techumim in water. One can be stoned for carrying, but one who carries in a covered Reshus ha'Rabim is exempt, for it is unlike the encampment in the Midbar. Surely, one who goes 12 Mil in [even] shallow water is exempt, for it is unlike Machaneh Yisrael! It is forbidden mid'Rabanan, so one may be lenient if it is a Safek whether the water is 10 Tefachim deep.
Ran (7b DH Tanu): According to the Rif, why do people embark less than three days before Shabbos? The Ba'al ha'Ma'or explains that this and starting a siege are forbidden due to danger. Three days before Shabbos are called 'before Shabbos.' He looks like one who stipulates to push aside Shabbos, for he precipitates a situation that will be Piku'ach Nefesh. The same applies to going to a Midbar or any dangerous place that will require Chilul Shabbos. In this way, the Ramban permits seafarers to embark on Shabbos and leave the port, without concern. The Isur to embark within three days was only when a Yisrael rents the entire boat. All the Melachah done on it is for him. If the boat is mostly Nochrim, the Melachah is done [mostly] for them. If a lamp was lit for a group that is mostly Nochrim, Yisre'elim may use its light.
Maharik (45, brought in Beis Yosef OC 248 DH v'Chasav): All agree that if entered the boat three days before Shabbos, if it goes in water less than 10 Tefachim deep, even if it is less than three Tefachim deep, it is permitted. Even though the Rif rejected R. Chananel, who says that it is due to Techumim, for if so it should be forbidden even if he embarked three days before Shabbos, he said so according to R. Chananel. R. Chananel permits above 10 because there is no Isur Techumim there, and forbids only below 10 less than three days before Shabbos, so the same should apply more than three days before Shabbos. The Rif himself can say that we do not forbid due to Techumim at all.
Beis Yosef (ibid.): Based on this, if the water is not salty, even if he entered on Erev Shabbos it is permitted even if the water is not 10 Tefachim deep. He overlooked the Rambam's Teshuvah that forbids going outside the Techum in a boat if the water is less than 10 Tefachim deep. Presumably, he does not argue with the Rif, his Rebbi. Also, they argue about the reason why one may not embark. The simple reading of the Rif is like [Teshuvas ha'Rambam]. Why should we learn it differently?! I disagree with Maharik.
Poskim
Shulchan Aruch (OC 248:1): One may embark on a boat even on Erev Shabbos, if he goes for a Mitzvah. For Reshus one may not embark less than three days before Shabbos.
Beis Yosef (DH Ein): We say in Gitin that the three days before Shabbos are considered before Shabbos. Also the Rivash (17) says so. The Rosh connotes that Wednesday is permitted. He says that Beis Hillel permit Wednesday. R. Yerucham says that the Ramban permits even Thursday, for then Shabbos is the third day from embarking. This is difficult. If so, the Beraisa should forbid Erev Shabbos, and permit Wednesday and Thursday, like it says regarding sending letters and renting Kelim.
Mishnah Berurah (4): The Magen Avraham brings many Acharonim who forbid Wednesday, but the Gra brings many Rishonim who permit.
Mishnah Berurah (5) and Sha'ar ha'Tziyun (2): Likewise it is forbidden before Yom Tov. All the reasons regarding Shabbos apply to Yom Tov as well.
Note: Regarding Yom Tov, there is no source to say that three days before pertain to the coming Yom Tov. However, sea sickness depends on three days. Ha'arah 26 in the Oz v'Hadar Mishnah Berurah says that Chachamim did not distinguish and forbid three days also before Yom Tov. However, Tzitz Eliezer (12:46:8) understands that the Mishnah Berurah forbids only Erev Yom Tov.
Rema: Before three days it is permitted even in a boat drawn by animals, even if the water is less than 10 Tefachim deep, even where the Yisrael will need to do Melachah on Shabbos to move the boat.
Taz (3): The three days after Shabbos pertains to the previous Shabbos, so he need not refrain due to the coming Shabbos. If he will need to do Melachah on Shabbos for Piku'ach Nefesh, this is not Chilul Shabbos.
Shulchan Aruch (2): The reason we do not embark less than three days before Shabbos is due to Oneg Shabbos. During the first three days after embarking, there is pain and nausea.
Beis Yosef (DH u'Mah she'Chasav Rabeinu Yesh): The Rif and Rosh rejected those who say that it is due to Techumim. Rather, it is due to Bitul Oneg Shabbos. The Rambam agrees.
Mishnah Berurah (13): We hold that even the Techum of 12 Mil is only mid'Rabanan in seas and rivers, for they are unlike the encampment in the Midbar. It is a Safek whether there are 10 Tefachim from the bottom of the boat to the sea floor, so we are lenient to say that there are 10, and there is no Isur Techumim above 10.
Kaf ha'Chayim (17): Some say that the Isur is like the decree against swimming, lest one make a flotation barrel.
Kaf ha'Chayim (18): Since it is due to Oneg Shabbos, sailors or others used to sailing, who do not get seasick, may embark less than three days before Shabbos.
Shulchan Aruch (ibid.): This refers to embarking on saltwater seas. There is no pain for one who embarks on rivers. Therefore, one may embark even on Erev Shabbos. This is if he does not know that it is less than 10 Tefachim deep. If we know that there is less than 10 Tefachim between the bottom of the boat and the floor of the river, one may not [leave the Techum] due to the Isur Techumim.
Magen Avraham (7): If the bottom of the boat is within 10 Tefachim of the river floor, even if one is above on the deck (more than 10 above the river floor), it is forbidden, since the boat is four wide. Also the Yere'im connote like this. The Bach says that Tosfos and the Rambam disagree. I do not understand this. In Eruvin, we needed to say that boats do not go where there are less than 10 Tefachim below the bottom of the boat. Therefore, one should be stringent like the Shulchan Aruch [for there is no proof that anyone disagrees - Machatzis ha'Shekel].
Magen Avraham (8): The Chidush is that within the Techum we do not decree lest he leave the Techum.
Gra (DH v'Hu): Since it is mid'Rabanan, we are lenient about a Safek.
Mishnah Berurah (14): Since the boat is wide and convenient to walk on, standing on the deck is like standing below. Some permit when he sits above 10 and his legs do not hang below 10. One may rely on this when needed.