4. It is permitted to travel by ship on Shabbos in order to pray together
with a "minyan" (ten adult males) or to fulfill another mitzvah, provided
the ship is traveling for others (Gentiles) as well. [In this instance,] it
is proper for the Jews to board the ship on Friday before the commencement
of Shabbos and remain there until after nightfall. They may return home
afterward [to sleep overnight] (1). It is, however, forbidden for the ship
to travel for the sake of Jews alone. (2)
FOOTNOTES:
(1) One is not allowed to travel more than 2000 cubits on Shabbos from the
place one establishes one's "residence" at the onset of Shabbos; this law
is based on the verse: "A man shall not leave his place on the seventh day
(i.e. on Shabbos)" (Exodus 16:29). The area within the 2000 cubits is
called one's "Techum Shabbos." Boarding a boat on Shabbos, looks like one
is intending to travel beyond 2000 cubits on Shabbos. However, if one
boards the boat on Friday, and remains there until it gets dark (some
require even making Kiddush and eating something on the boat), then the
boat is seen as one's "home" for Shabbos ("konoh Shvisa"), and one may
re-enter it on Shabbos itself to embark on the journey (Aruch Hashulchan
248:13).
(2) Note the compendium to the Shulchon Oruch, Chapter 248, the N'tiv
Chayim, which deals with this subject at length.