early 14c., "action of defending, resistance; means of protection, fortification," shortening of defens (see defense). The same pattern also yielded fend, fender; and obsolete fensive "defensive" (late 16c.). Spelling alternated between -c- and -s- in Middle English. Sense of "enclosure" is first recorded mid-15c. on notion of "that which serves as a defense." Sense of "dealer in stolen goods" is thieves' slang, first attested c. 1700, from notion of such transactions taking place under defense of secrecy.
To be figuratively on the fence "uncommitted" is from 1828, perhaps from the notion of spectators at a fight, or a simple literal image: "A man sitting on the top of a fence, can jump down on either side with equal facility." [Bartlett, "Dictionary of Americanisms," 1848].