"one of a pair, an equal." Middle English macche, from Old English mæcca "companion, mate, one of a pair, wife, husband, one suited to another, an equal," from gemæcca, from Proto-Germanic *gamakon "fitting well together" (source also of Old Saxon gimaco "fellow, equal," Old High German gimah "comfort, ease," Middle High German gemach "comfortable, quiet," German gemach "easy, leisurely"), from PIE root *mag- "to knead, fashion, fit."
Meaning "person or thing that exactly corresponds to another" is from c. 1400. Middle English sense of "matching adversary, person able to contend with another" (c. 1300) led to sporting meaning "contest," which is attested from 1540s. Meaning "a matrimonial compact" is from 1570s.