Old English þrescan, þerscan, "to beat, sift grain by trampling or beating," from Proto-Germanic *threskan "to thresh," originally "to tread, to stamp noisily" (source also of Middle Dutch derschen, Dutch dorschen, Old High German dreskan, German dreschen, Old Norse þreskja, Swedish tröska, Gothic þriskan), from PIE root *tere- (1) "to rub, turn."
The basic notion is of men or oxen treading out wheat; 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, such as Italian trescare "to prance," Old French treschier "to dance," Spanish triscar "to stamp the feet." For metathesis of -r- and vowel, see wright.