There have been several suggestions above that pretty much sum it up.
A better question is this: WHY do you want to force them on the ship? Is it because you like keeping them ship-bound for a particular reason (such as specific encounters or events), or just that you don't like the idea of such forms of transportation?
Asking players to give up their abilities or worse, inventing excuses to deny them said abilities, can lead to player frustration and dissatisfaction. Players will tolerate such treatment when it seems reasonable, but not consistently.
If you must keep them ship-bound, then several of the suggestions above work well. Guarding a large object is a good example. Introducing concepts of randomization and demi-planes are another.
For example, let's say they need to locate the 'Roaming Island of Glantorn Rock'. The island surfaces once every day, and sinks beneath the waves when the sun sinks beneath the waves each night. It resists all attempts to scry it...or when successful, all the viewer can see are the murky depths when it is below, or an infinite expanse of ocean when it is not. Unbeknownst to the players, the island rests on the back of a giant snapping turtle, a demi-god of sorts, that is ignorant of it's burden, or has long since forgotten it. The island is the home to an ancient city, filled with magical treasures and strange creatures, all of whom are cursed and trapped on the island, after they failed to leave before the setting of the sun. They must find the island, penetrate the city, and find the chamber of secrets, wherein the discover Important Campaign Secret #32, the answer to the riddle that they have been seeking.
Or perhaps the players need to find the 'Delving Spout', a vortex of water that acts as the only known entryway into the demiplane of Drowningdell, a 'kingdom in a bottle' hidden beneath the waves, and the only place that the party can locate 'X', a foozle necessary to whatever the party is doing.
Perhaps they need to transport the Guilding Stone, at the request of the King. A remote colony in the middle of an oceanic expanse known only as the Gloom Waves needs the protection of the Empire...but the king will not recognize the colony as established unless the single stone, fully 10 tons in weight, is placed in the heart of the colony. Rumor has it that the stone is central in an ancient imperial ritual....but all the players know is that they've got to play nursemaid to a giant piece or rock...and the imperial stonesmith, who must work the stone both en route and upon arrival. And the Empire has many enemies, who would rather it not come to pass.
Now, there are other ways to make this more accessable to high-level players. For example, let's say the players can get to the island in the last example. Let them shuttle back and forth between the boat, the village and the kingdom...and them make things happen at more than one location at the same time. Showing them that memorizing too many or too few of a certain kind of spell is a lot different from preventing them from using their powers.