Old English of, unstressed form of æf (prep., adv.) "away, away from," from Proto-Germanic *af (source also of Old Norse af, Old Frisian af, of "of," Dutch af "off, down," German ab "off, from, down"), from PIE root *apo- "off, away."
The primary sense in Old English still was "away," but it shifted in Middle English with use of the word to translate Latin de, ex, and especially Old French de, which had come to be the substitute for the genitive case. "Of shares with another word of the same length, as, the evil glory of being accessory to more crimes against grammar than any other." [Fowler]
Also by 1837 of in print could be a non-standard or dialectal representation of have as pronounced in unstressed positions (could of, must of, etc.)
by c. 1200 as an emphatic form of Old English of (see of), employed in the adverbial use of that word. The prepositional meaning "away from" and the adjectival sense of "farther" were not firmly fixed in this variant until 17c., but once they were they left the original of with the transferred and weakened senses of the word. Meaning "not working" is from 1861.
Off the cuff "extemporaneously, without preparation" (1938) is from the notion of speaking from notes written in haste on one's shirt cuffs. In reference to clothing, off the rack (adj.) "not tailored, not made to individual requirements, ready-made" is by 1963, on the notion of buying it from the rack of a clothing store; off the record "not to be publicly disclosed" is from 1933; off the wall "crazy" is 1968, probably from the notion of a lunatic "bouncing off the walls" or else in reference to carom shots in squash, handball, etc.