Old English þrescan, þerscan "to beat, sift grain by trampling or beating," from Proto-Germanic *threskanan "to thresh," originally "to tread, to stamp noisily" (cf. Middle Dutch derschen, Dutch dorschen, Old High German dreskan, German dreschen, Old Norse þreskja, Gothic þriskan), from PIE root *tere- "to rub, turn" (see throw).
The basic notion is of treading out wheat under foot of men or oxen, later, with the advent of the flail, the word acquired its modern extended sense of "to knock, beat, strike." The original Germanic sense is suggested by the use of the word in Romanic languages that borrowed it, e.g. Italian trescare "to prance," Old French treschier "to dance," Spanish triscar "to stamp the feet."