Originally, the term was to “throw in the sponge” and it first appeared in “The Slang Dictionary” of 1860.
Back in the 19th century, sponges were used at prize fights to clean fighters’ faces. If a contestant’s manager threw in the sponge , it meant that the fighter had had enough and was admitting defeat. In admitting defeat, the sponge was no longer required as the win was awarded to the other fighter, thus ending the match.
Over the years, towels have been substituted for sponges at boxing matches and prize fights. The term has followed suit and likewise, it was substituted the word towel for sponge hence the term to “throw in the towel.”