google
ref
early 19th century: shortening of od rat, euphemism for God rot .
wiktionary
ref
An aphetism of od- rat(“God rot”) as a minced oath.
etymonline
ref
drat (interj.)
1815, minced form of the exclamation God rot (something or someone). Compare dog-gone. Related: Dratted.