Masturbation \mas-ter-BEY-shuhn\ , noun;
1. The stimulation or manipulation of one's own genitals, especially to orgasm; sexual self-gratification
2. The stimulation, by manual or other means exclusive or coitus, of another's genitals, especially to orgasm
This word is first attested in 1711, though it technically dates to the 1620's as mastupration. It comes from French masturbation from Latin masturbatione, a noun of action from Latin masturbari ("to masturbate"). The etymology is not 100% confirmed, but it has long been believed to come from *manstuprare, which is a combination of manus + stuprare ("hand" + "defile oneself") with some influence from turbare ("to stir up"). It has also been suggested that the first element comes from an unattested word for "penis," possibly *mazdo-.
Another non-slang word for this act is onanism, which refers to the biblical character Onan, Judah's son. The story goes that after Onan's brother Er died, Judah sent him to fulfill his duty as brother-in-law by impregnating Er's widow. He has sex with her, but pulled out before climax and 'spilled his seed on the ground.' Doing that broke a rule and God killed him for being wicked. Some interpret the story to mean that 'spilling seed' without trying to procreate makes the act a sin.