This proverb first appears in English in a book of proverbs assembled by Thomas Heywood in 1546:
Thus by these lessons ye may learne good cheape
In wedding and all things to looke ere ye leaped
The proverb in this case addresses young women, warning them to really know what they are getting into before they marry. With divorce not allowed in England at that period except in very rare cases, it was important that a woman carefully check out a potential future spouse before making a terrible mistake.
The proverb, however, goes back to a fable by Aesop. In it, a fox trapped in a well persuades a goat to jump in and save him. The foolish goat leaps in without looking. The fox is able to climb on the goat to get out, leaving the goat trapped in the well.
In both cases, the proverb means that one should check out a situation carefully before getting involved in it so as to not get hurt.