late 14c., of the sun, "to send out long, low beams," from shaft (n.1). The modern colloquial sense of "treat cruelly and unfairly" is by 1958, perhaps with suggestion of sodomy. Related: Shafted; shafting.
in mines and earthworks, "long, narrow, vertical or inclined passage sunk into the earth," early 15c., probably from shaft (n.1) on notion of "long and cylindrical," perhaps as a translation of cognate Low German schacht in this sense (Grimm's suggestion, though OED is against it). Or it may represent a separate (unrecorded) development in Old English directly from Proto-Germanic *skaftaz if the original sense is "scrape, dig." The slang sense of shaft (n.1) is punned upon in the song "She Got the Gold Mine, I Got the Shaft," a U.S. hit for Jerry Reed in 1982.
"long, slender rod," originally "staff or pole forming the body of a spear or lance; spear-shaft," also, perhaps by synecdoche, "spear;" Middle English shafte, from Old English sceaft from Proto-Germanic *skaftaz (source also of Old Norse skapt, Old Saxon skaft, Old High German scaft, German schaft, Dutch schacht, not found in Gothic).
OED suggests this might be explained as a Germanic passive past participle of PIE root *(s)kep- "to cut, to scrape" (source of Old English scafan "to shave, scrape, polish") on notion of "tree branch stripped of its bark." But compare Latin scapus "shaft, stem, shank," Greek skeptron "a staff" (see scepter) which appear to be cognates.
Extended generally to any body of long, cylindrical shape; the meaning "beam or ray" (of light, etc.) is attested from c. 1300; that of "arrow" (especially a long one, used with a long bow) is from c. 1400; that of "a long, straight handle of a tool or utensil" from 1520s. The mechanical sense "long rotating rod for transmission of motive power in a machine" is from 1680s.
The vulgar slang meaning "penis" is recorded by 1719 on notion of "columnar part" (late 14c.); hence probably modern slang shaft (v.) and the related noun meaning "act of unfair treatment" (1959), though some early sources insist this is from the notion of a wound.