AVN (link below) has dedicated a new article to the history of the internet phenomenon known as fapping. When the recent celebrity photo breach was dubbed The Fappening, it brought the word into sharp focus. Believe it or not, however, the word "fap" dates all the way back to 1999, back when the internet was still a series of tubes invented by Al Gore.
Allow AVN to drop some fifty cent words on you...
Needless to say, the word itself—a nominalization of the verb "to fap," which Know Your Meme defines as "an onomatopoeic Internet slang term for the act of masturbation"—is an obvious pejorative for those who see the hack as yet another reflection of a pervasive and perverse cultural misogyny. Though to be clear, even someone who does not share that perspective would have to agree that the term obviously implies that the photos are meant to be fodder for mass male masturbation.
So where did the word come from, you ask? It came from this cartoon...
Ah, VCR humor. Never not funny. You can read the entire history of fapping over at AVN.