"hemorrhoids," early 15c., from Medieval Latin pili "piles," which is of uncertain origin, perhaps from Latin pila "ball" (see pill (n.)) and so called from shape.
Entries linking to piles
pill n.
c. 1400, pille, "globular or ovoid mass of medicinal substance of a size convenient for swallowing," from Middle Dutch or Middle Low German pille and Old French pile, all from Latin pilula "pill," literally "little ball," diminutive of pila "a ball, playing ball," which is perhaps related to pilus "hair" if the original notion was "hairball."
The figurative sense "something disagreeable that must be accepted ('swallowed')" is from 1540s. The slang meaning "disagreeable or objectionable person, bore," is by 1871. The pill "contraceptive pill" is from 1957.