Entries linking to hem-stitch
Old English hem "a border" of cloth or a garment, from Proto-Germanic *hamjam (source also of Old Norse hemja "to bridle, curb," Swedish hämma "to stop, restrain," Old Frisian hemma "to hinder," Middle Dutch, German hemmen "to hem in, stop, hinder"), from PIE *kem- "to compress" (source also of Armenian kamel "to press, squeeze," Lithuanian kamuoti "press together, stop," Russian kom "mass, clot, clod").
Apparently the same root yielded Old English hamm, common in place names (where it means "enclosure, land hemmed in by water or high ground, land in a river bend"). In Middle English, hem also was a symbol of pride or ostentation.
If þei wer þe first þat schuld puplysch þese grete myracles of her mayster, men myth sey of hem, as Crist ded of þe Pharisees, þat þei magnified her owne hemmys. [John Capgrave, "Life of Saint Gilbert of Sempringham," 1451]
Senses in sewing and shoemaking first recorded late 13c.; meaning "bit of clothing one is (or isn't) wearing" is from c. 1500. Meaning "a stroke of work" (of any kind) is attested from 1580s. Surgical sense first recorded 1520s. Sense of "amusing person or thing" is 1968, from notion of laughing so much one gets stitches of pain (compare verbal expression to have (someone) in stitches, 1935).