"Big sailing vessels required large crews, since most work was
done by hand. Noise of winds and waves made it difficult to transmit
orders by shouting. So the boatswain used a special pipe whose notes
could usually be heard even in a storm.

When a master wished to give a special instructions or give a crew
an opportunity to voice complaints, the boatswain piped 'All hands
on deck.' Another signal was used to send men to their quarters
below deck. Sometimes a harsh captain would break off discussion
and signal the boatwain to pipe the crew down. Failure to obey could
be interpreted as mutiny, so rebellion was rare.

Long used literally in the lingo of the sea, the expression was
adopted and modified at the U.S. Naval Academy. About 1890 it became
customary for a man in his third or fourth year to command a plebe,
"Pipe down!' Instead of being an order to go to quarters, this was
a demand for silence, and today we treat it as slightly milder but
nearly equivalent to 'Shut up!"