The phrase first appeared in print as long ago as the year 1300. The 'sound' part refers to the idea of 'wholeness' or 'good condition', as when people nowadays say someone/something is "As sound as a pound". Really, therefore, the two words 'safe' and 'sound' mean much the same here...ie completely secure.
I have been informed by a naval officer that safe and sound has a slightly different meaning in shipping terms, i.e. a vessel may be "safe" (not under attack or imminent threat) and "sound" (not seriously damaged and therefore in danger of sinking). As Quizzy says, the use of both words indicates a secure position for the vessel, but for different reasons.