Old English hecg "hedge," originally any fence, living or artificial, from West Germanic *hagjo (source also of Middle Dutch hegge, Dutch heg, Old High German hegga, German Hecke "hedge"), from a verb *hagjanan, from PIE root *kagh- "to catch, seize; wickerwork, fence" (source also of Latin caulae "a sheepfold, enclosure," Gaulish caio "circumvallation," Welsh cae "fence, hedge"). Related to Old English haga "enclosure, hedge" (see haw (n.)).
Figurative sense of "boundary, barrier" is from mid-14c. As hedges were "often used by vagabonds as places of shelter or resort" [Century Dictionary], the word, compounded, "notes something mean, vile, of the lowest class" [Johnson], from contemptuous attributive sense of "plying one's trade under a hedge" (hedge-priest, hedge-lawyer, hedge-wench, etc.), a usage attested from 1530s. The noun in the betting sense is from 1736 (see hedge (v.)).