The first use of the phrase "red-handed" originated in 15th-century Scotland and, at the time, referred to someone literally having blood on their hands after committing a crime.
In 1432, a record of "The Scottish Acts of Parliament of James 1" includes a reference to someone having a "red hand" as a consequence of their wrongdoing — in this case, most likely poaching an animal from forbidden hunting grounds:
That the offender be taken reid hand, may be persewed, and put to the knowledge of ane Assise, befoir the Barron or Landeslord of the land or ground, quhidder the offender be his tennent, unto quhom the wrang is done or not ...
While these outdated spellings may take some effort to wade through, this early evidence of using "reid hand" became part-and-parcel of Scotland's legal proceedings. In time, referring to someone being "red hand" was equal to saying that someone was caught in the act of committing a crime, including variations on the phrase such as "apprehended redhand" or "taken with redhand."
Historians believe the phrase evolved from "red hand" to "red-handed" as it was bandied about in colloquial conversations of the era, so much so that the term was eventually immortalized in the literary canon.
In 1820, Sir Walter Scott's "Ivanhoe" the phrase appears thusly:
I did but tie one fellow, who was taken redhanded and in the fact, to the horns of a wild stag.