"military punishment in which offender runs between rows of men who beat him in passing," 1640s, gantlope, gantelope, from Swedish gatlopp "passageway," from Old Swedish gata "lane" (see gate (n.)) + lopp "course," related to löpa "to run" (see leap (v.)). Probably borrowed by English soldiers during Thirty Years' War.
By normal evolution the Modern English form would be *gatelope, but the current spelling (first attested 1660s, not fixed until mid-19c.) is from influence of gauntlet (n.1) "a glove," "there being some vague association with 'throwing down the gauntlet' in challenge" [Century Dictionary].