504. Boats and the Techum Shabbos

74:3 In a case where a person may embark on a ship on Friday, it is permitted if he boarded it on Friday and stayed there until nightfall. Even if he then went home and slept in his house, he may board the ship on Shabbos day, provided that the ship is not traveling exclusively for the sake of Jews. (If the majority of passengers are Jewish, the the work is effectively being performed for Jews - Bi'ur Halacha 248:2 s.v. v'chein nahagu.) However, since he was at home on Shabbos, he acquires his house as the center of his Shabbos boundary (techum). Therefore, if the ship travels beyond the limits of the techum and arrives at a a port on Shabbos, the Jew is limited to an area of four cubits (as is the rule for one who travels outside his Shabbos limits). (The entire ship is considered like four cubits, so he may traverse it but not disembark - Mishnah Brurah 404:10.)

74:4 One may board a ship in order to daven with a minyan or for the sake of some other mitzvah provided that the ship is not traveling exclusively for Jews. In any case, the Jew should board the ship on Friday during the daylight hours and remain there until it becomes dark. He may return to his home after nightfall and then come back to the ship on Shabbos day. This course of action should not be relied upon if the ship is traveling exclusively for Jews.