"frame with bars," c.1300, possibly from Middle Dutch rec "framework," related to recken "stretch out," cognate with Old English reccan "to stretch out," from Proto-Germanic *rakjanan (cf. Old Norse rekja, Old Frisian reza, Old High German recchen, German recken, Gothic uf-rakjan "to stretch out").
Meaning "instrument of torture" first recorded mid-15c. (verb meaning "to torture on the rack" is from early 15c.), perhaps from German rackbank, originally an implement for stretching leather, etc. Figurative sense of "agony" is from 1590s. Mechanical meaning "toothed bar" is from 1797 (see pinion). Meaning "set of antlers" is first attested 1945, American English; hence slang sense of "a woman's breasts" (especially if large), by 1991. Off the rack in reference to clothing is from 1951.
"gait of a horse," 1520s (implied in racking), perhaps from French racquassure "racking of a horse in his pace," of unknown origin. Or perhaps a variant of rock (v.1).
"clouds driven before the wind," c.1300, also "rush of wind, collision, crash," possibly from Old English racu "cloud," reinforced by Old Norse rek "wreckage, jetsam," or by influence of Old English wræc "something driven." Originally a northern word, perhaps from an unrecorded Scandinavian cognate of Old English racu. Often confused with wrack (q.v.), especially in phrase rack and ruin (1590s). The distinction is that rack is "driven clouds;" wrack is "seaweed cast up on shore."
"to sleep," teen-ager slang, 1960s, from rack (n.1) (rack was Navy slang for "bed" in 1940s). Related: Racked; racking. Rack up "register accumulate, achieve" is first attested 1943 (in "Billboard"), probably from method of keeping score in pool halls.