late 15c., dews, "the 2 in dice or cards," also "a roll of 2 in dice" (1510s), from Old French deus (Modern French deux), from Latin duos (nominative duo) "two" (from PIE root *dwo- "two"). The spelling -ce from -s to reflect voiceless pronunciation is as in dice, pence, etc.
The word became a mild oath by 1710, about 50 years after it was first attested in the sense of "bad luck, the devil, etc.," perhaps because two was the lowest score, and probably by similarity to Latin deus and related words meaning "god." According to OED, 16c. Low German had der daus! in the same sense, which perhaps influenced the English form.
In tennis, "a stage of the game in which both players or sides have scored 40, and one must score 2 points to win," 1590s. Deuce coupe is 1940s hot-rodder slang for "souped up two-door car," especially a 1932 Ford. Related: Deuced; deucedly.