Although the phrase “dead to rights” was first published in the Vocabulum or The Rogue’s Lexicon by George Matsell in 1859, the history of the phrase can be split in two to explain how the phrase came to be.
“Dead” is a slang use of the word that means “absolutely and without doubt” and dates back to the 16th century England. The phrase “to rights” has been used since the 14th century in England to mean “in a proper manner” or “in proper condition or order.”
So when someone has been caught “dead to rights” what’s happened is that they’ve been caught red-handed in the act of committing a crime or making a mistake.