"contrivance for catching unawares," Middle English trappe, from late Old English træppe, treppe "snare, trap" (for taking game or other animals), from Proto-Germanic *trep- (source also of Middle Dutch trappe "trap, snare"), related to Germanic words for "stair, step, tread" (Middle Dutch, Middle Low German trappe, treppe, German Treppe "step, stair," English tread (v.)).
This is probably (Watkins) literally "that on or into which one steps," from PIE *dreb-, an extended form of a root *der- (1), base of words meaning "to run, walk, step." The English word also is probably akin to Old French trape, Spanish trampa "trap, pit, snare," but the exact relationship is uncertain.
Figurative use is by c. 1200 in theology. The sense of "deceitful practice, device or contrivance to betray one unawares" is recorded from c. 1400.
The meaning "U-shaped section of a drain pipe," to prevent passage of air or gases through the pipe, is from 1833. The slang meaning "mouth" is attested by 1776.
It is attested from 1590s as the name of the pivoted wooden instrument used to throw in the game of trap-ball (short for trap-stick; trap-sticks as a figure of thin legs is by 1714). By 1812 it was extended to any device for sudden throwing or releasing by means of a spring, etc. Hence trap-shooting (by 1892).
In some specialized senses it has converged with provincial trap words for "stairs" from Low German and Scandinavian (see trap (n.2)). Also compare rattletrap.