Etymology
onanism (n.)

"masturbation," also "coitus interruptus," 1727, from Onan, name of the son of Judah (Genesis xxxviii.9), who spilled his seed on the ground rather than impregnate his dead brother's wife: "And Onan knew that the seed should not be his; and it came to pass, when he went in unto his brother's wife, that he spilled it on the ground, lest that he should give seed to his brother." The moral point of the verse was redirected by those who sought to suppress masturbation. Related: Onanist; onanistic.

Related entries & more 
masturbation (n.)
Origin and meaning of masturbation

"deliberate erotic self-stimulation," 1711 (earlier as mastupration, 1620s), from French masturbation and directly from Modern Latin masturbationem (nominative masturbatio), noun of action from past-participle stem of Latin masturbari "to masturbate."

The long-standing speculation is that this Latin word is altered (probably by influence of turbare "to disturb, confuse") from *manstuprare, from manu, ablative of manus "hand" (see manual) + stuprare "defile" (oneself), from stuprum "defilement, dishonor," related to stupere "to be stunned, stupefied" (see stupid). Hence the earliest form of the word in English. But perhaps the first element represents an unattested *mazdo- "penis" [OED]. An earlier technical word for this was onanism. Related: Masturbational.

Farmer and Henley ["Slang and Its Analogues," 1898] lists among the slang terms for "to masturbate" or "masturbation" frig (which they trace to Latin fricare "to rub") to bob; to box the Jesuit; to chuff, to chuffer; to claw; to digitate (of women); to fight one's turkey (Texan); to handle; to indorse; to milk; to mount a corporal and four; to dash one's doodle; and they note that it was "sometimes known as KEEPING DOWN THE CENSUS."

Related entries & more