1670s, slang, of uncertain origin. Perhaps a schoolboy shortening of Latin flagellare "flagellate" (see flagellum); Century Dictionary suggests perhaps from a Low German word "of homely use, of which the early traces have disappeared." OED finds it presumably onomatopoeic. Figurative use from 1800. Related: Flogged; flogging.
Others are reading
Definitions of flogging from WordNet
beating with a whip or strap or rope as a form of punishment;