c. 1600, "fight or do battle for, strive to win or hold," from French contester "dispute, oppose," from Latin contestari (litem) "to call to witness, bring action," from assimilated form of com "with, together" (see con-) + testari "to bear witness," from testis "a witness," (see testament).
The notion of the Latin compound is "calling witnesses" as the first step in a legal combat. Meaning "make a subject of contention or dispute, enter into competition for" is from 1610s. Sense of "to argue in opposition, call into question" is from 1660s. Related: Contestable; contested; contesting.