If I were to take this literally, I might think this meant that someone was going to strip me naked and tie me to to a palm tree on a sunny day. I also understand that tanning refers to the process by which leather is cured, whether by chemicals or UV exposure. Growing up in the states, I know this to mean that you're about to get a thorough ass whooping.
It seems obvious that this idiom take it's origins from the way that leather is processed, but what is the relationship? Are hides physically beaten as part of the tanning process? Is it hyperbole that you're going to skin someone and make a nice purse out of them? Or maybe the nice red color your butt takes on after a good lashing?
Best Answer
The reference is to the tanning process in leather making (as you've guessed) and The American Heritage Dictionary of Idioms, Second Edition (by Christine Ammer) provides more details:
In ancient times, in the tanning process, the skin might have been beaten to remove the flesh and fat; however it is not the only method mentioned as some sources say that sharp stones or bones were used for scraping the skin as well. In the seventeenth century (the era when the idiom is originated), the tanning process didn't involve beating in the defleshing step. The skin is stretched and scraped with defleshing tools. Beating is mentioned in some sources as a method of softening the skin but it is usually done after the tanning process. (Here is an article about tanning in the seventeeth century: https://www.nps.gov/jame/learn/historyculture/tanning-in-the-seventeenth-century.htm)
Further supporting evidence from the book The Dictionary of Clichés: A Word Lover's Guide to 4,000 Overused Phrases and Almost-Pleasing Platitudes by Christine Ammer again:
In OED, the earliest example is from c1670:
The discoloration of the skin in the allusion can be explained with the use of tannin in the traditional tanning process which gives the distinctive color of the tanning. Here is an explanation from the book How it Works: Science and Technology, Volume 9:
The flow diagram of the traditional tanning process from Davarg leather company: