On the high seas when the wind would start to blow hard and the water became rough, crewmen and travelers would go below deck and down to their cabins in order to ride out the storm and avoid becoming seasick. In this way they literally retreat to a location “under the weather."
In digging a little further, we find out more. According to Salty Dog Talk: The Nautical Origins of Everyday Expressions, by Bill Beavis and Richard G. McCloskey, the term in its entirety is “under the weather bow;” they tell us the weather bow is “the side [of the ship] upon which all the rotten weather is blowing.”
So here I am, riding out the remaining storm, safely below deck and "under" the weather.