Like a lot of sayings, this one comes from the old sailing ships. If a sail was left unsecured (the 'sheet' is tyhe rope, not the sail itself) then the ship would sail with a list to one side, much like a drunken man trying to walk straight. Leaving 'three sheets to the wind', or unsecured, would leave the sail flapping uselessly, and the ship sailing all over the place.