The bosun on naval ships has a pipe roughly of the penny-whistle variety. He uses it to give orders and carry out ceremonies. For example, you've probably seen the Admiral being 'piped aboard'. The 'pipe down' signal was one to tell sailors that it was now 'lights out' as it were, and time to go to sleep...ie 'Be quiet!', which is what we normally mean by the phrase.