It means giving up, giving up something, or giving up something (the expression is taken from the act in the sport of boxing, where corner helpers throw in the towel to announce that their boxer is not fit to continue in combat).
Throw in the towel: this phrase comes from the Pugilism when one of the parties does not want to continue the fight should throw in the towel on the canvas by accepting his defeat. That's why throwing in the towel means giving up.