1773, "lively square dance for four couples," from French quadrille (17c.), originally one of four groups of horsemen in a tournament (a sense attested in English from 1738), from Spanish cuadrilla, diminutive of cuadro "four-sided battle square," from Latin quadrum "a square," related to quattuor "four" (see four). The craze for the dance hit England in 1816, and it underwent a vigorous revival late 19c. among the middle classes.

Earlier the name of a popular card game for four hands, and in this sense from French quadrille (1725), from Spanish cuartillo, from cuarto "fourth," from Latin quartus. OED notes it as fashionable from 1726 ("and was in turn superseded by whist"), the year of Swift's (or Congreve's) satirical ballad on the craze:

The commoner, and knight, the peer, Men of all ranks and fame, Leave to their wives the only care, To propagate their name; And well that duty they fulfil When the good husband's at Quadrille &c.