In a sailing boat, (very simply) if you imagine a wind coming from right angles to the sail, the side hit by the wind is called windward, the side sheltered from the wind by the sail is called leeward (pronounced loo'ard). To give someone leeway is to ensure you do not sale so close as to steal the wind from their sails. From there it went on to mean to give someone space.
More or less right. I believe the saying was originally to give yourself leeway. To take Waldos example, if you are in the middle of the ocean, no problem. If, however, you are fairly close inshore and the wind is blowing toward shore, you may have a hell of a problem tacking back out to sea and run a big risk of grounding. Therefore you should give yourself leeway. Another old sailing axiom is 'Never sail to a lee shore' for this reason.