They're away from home for long periods of time, like the navy. They operate large vessels with hundreds or even thousands of crew members so a naval rank structure would make sense. Naval terminology can be easily adapted to a starship (port, starboard, bow, etc.). Serving on a starship would probably be a lot like serving on an aircraft carrier or a submarine.
Exactly. Even though in theory, today's British/American rank systems for navies are perfectly eqivalent with the rank systems for armies/air forces, the organizational structure of a Starfleet-style setup would more closely approximate a navy than an army or an air force.
It's pretty idiotic to apply army ranks on air forces to begin with. Army ranks have developed out of the need to control a hierarchy where the smallest fighting unit is about a dozen men, the next one several dozen, then a hundred, several hundred, then thousands. That is, first a group of warriors that can be controlled by talk and hand signs and can fight coherently within sight of each other; then a group manageable by shouts and gestures; then a collection of such groups big enough to make a difference in swordfights, or musket fights, or in raining arrows; then multiples thereof, only manageable through the use of messengers and preplanning.
Air forces never had it like that. The smallest unit of significance was just one or two men, piloting an aircraft - or a dozen in
very exceptional flying machines. The next unit would already be in the hundreds: the support force needed to keep even a single plane flying, but more properly applied for keeping a group of planes in the air. Ranks there never made organizational sense - they were originally applied just for reasons of payscale and prestige, sometimes with the senior officer controlling merely twice as many people as the next junior one.
The naval rank system is a mixture of pragmatism and payscale-prestige. A navy wouldn't need quite that many ranks, really, because there is no such thing as a naval platoon or a naval regiment, practically speaking. Ships are basically batallions, with companies for the various watches, calling for Colonels and Majors as the leaders. And formations of ships are already divisions or entire armies, requiring General/Admiral level of control. In contrast, a navy needs a wide variety of specialist officers and specialist men, basically equal in importance, for whom position is far more significant than rank.
Still, the naval division of responsibilities between ranks makes more sense for a Starfleet than the army one. The various junior officers are more "clustered" with the senior ones, all basically presiding over the entire ship rather than over a hierarchy of groups of people - that's definitely a "big vehicle" thing and not a "battlefield" or "small vehicle" (like tank or aircraft) thing.
Timo Saloniemi