It comes from a nautical term.To be �three sheets to the wind� is to be drunk. The sheet is the line that controls the sails on a ship. If the line is not secured, the sail flops in the wind, and the ship loses headway and control. If all three sails are loose, the ship is out of control.
The original form of the expression was three sheets in the wind (not "to"), which literally means 'with the sail completely unsecured', and thus flapping about, and with the boat itself thus unsteady. (Sails can be secured with varying numbers of sheets, but the square-rigged boats used at the time when the expression became current usually had three sheets.) There are many other nautical expressions for drunkenness, such as "with decks awash," "half seas over," and "over the bay," but few of them have spread so thoroughly to the mainstream.
Three sheets in the wind is first found in the early 1820s in both British and American sources. There are many other variants ("a sheet in the wind," meaning 'somewhat drunk', etc.), and the most common form today is three sheets to the wind.