To avoid committing oneself; to leave a means of retreat open.
Hedge has been used as a verb in English since at least the 16th century, with the meaning of 'equivocate; avoid commitment'. For example, in Shakespeare's Merry Wives of Windsor, 1598:
"I, I, I myself sometimes, leaving the fear of God on the left hand and hiding mine honour in my necessity, am fain to shuffle, to hedge and to lurch ."
It began being used in relation to financial transactions, in which a loan was secured by including it in a larger loan, in the early 17th century. Initially, the phrase associated with this form of hedging was 'hedging one's debts'. For example, John Donne's Letters to Sir Henry Goodyere, circa 1620:
"You think that you have Hedged in that Debt by a greater, by your Letter in Verse."
'Hedging one's bets' was coined later in that century. It referred to the laying off of a bet by taking out smaller bets with other lenders. The purpose of this was to avoid being unable to pay out on the original larger bet. The phrase was first used by George Villiers, the 2nd Duke of Buckingham, in his satirical play The rehearsal, 1672:
"Now, Criticks, do your worst, that here are met; For, like a Rook, I have hedg'd in my Bet."
It has been speculated that the verb 'to hedge' derives from the noun hedge, i.e. a fence made from a row of bushes or trees. These hedges were normally made from the spiny Hawthorn, which makes inpenetrable hedges when laid. The theory goes that to hedge a piece of land was a cautious, safety-first act and that this gave rise to the 'secure, non-committed' meaning. That's an interesting idea, but there's little apart from plausibility to support it.