c.1400, probably a fusion of Middle English scratten and crachen, both meaning "to scratch," both of uncertain origin. Related: Scratched; scratching.
Billiards sense of "to hit the cue ball into a pocket" is first recorded 1909 (also, originally, itch), though earlier it meant "a lucky shot" (1850). Meaning "to withdraw (a horse) from a race" is 1865, from notion of scratching name off list of competitors; used in a non-sporting sense of "cancel a plan, etc." from 1680s. To scratch the surface "make only slight progress in penetrating or understanding" is from 1882. To scratch (one's) head as a gesture of perplexity is recorded from 1712.