Instead of being thanked, he was vilified and labelled a pervert.
The man has since taken to social media to vent about the situation.
"No idea why I cared (I'm married and completely uninterested) but I go into helpful mode and pull my headphones out and turn around quietly enough that only the two of us can hear and say this: 'Hey this is super creepy, but I'd feel creepier if I didn't say something.
"'When you squat, your pants stretch and go completely see through on your a**'.
"Again I thought I was being helpful and that she'd want to know, but wholly s*** did she not see it that way."
"This girl practically screams: 'You f***ing pervert! Stop staring at my a**!'
"Not needing to be told twice now that half the gym is staring at me, I go back to my workout and suffer the angry looks for another 20 minutes and go home."
After returning home he told his wife about the incident, who said he was in the wrong for pointing it out.
In his post, he asked readers if he was in the wrong for telling the woman of her wardrobe malfunction.
A number of people agreed with him, saying he did the right thing and claimed he is not a pervert.
"I would definitely want someone to tell me if my pants were see-through when I moved.
"If she already knew and didn't care she could have just said thanks and left it. You are not a pervert for noticing someone's wearing see-through clothing."
Another said: "Showing your body is one thing. Repeatedly winking your brown eye at a gym full of people ... That's a whole new level. Well done on trying to do the right thing."
Others argued that the problem came from his choice of wording, rather than simply pointing it out.
"You're the a**hole for making it awkward and creepy by even mentioning her a**," replied another.
"You could have just said her pants were see-through and left it at that."