Is it legal? In a store such as JCpennies, Macy's, or something like that? And what about public restrooms?
Probably not. While a dressing room is a place where a person may have an expectation of privacy, it is not a full expectation. Most dressing rooms in stores such as you suggest have dressing rooms reserved for men and women. Hence in a Heterosexual union, one member of the couple will be trespassing and there is also an assumption on the part of Law enforcement that this is considered lewd behavior and this would be covered under the rubric of Indecent exposure, or disorderly conduct. That however is an open issue and an argument could be made that as the dressing room is not a public place it may not be open to such a charge.
On the other hand, do you want to explain this behavior or arrest to a potential employer some day?
One other thought. If I were a cop I would charge the crime under public nuisance or as a health offense as exposure to the sexual fluid of another may expose an innocent user to disease. I think this may be a better way to prosecute this type of behavior without insulting the public's perceived right to privacy.
As for my collegues response, sexual mores do differ. I do not condone the acts described, but I do not feel it appropriate to scold or question the mores of the questioner. Maybe he owns a business and ran into this issue and wants to know how to handle it. I applaud you for using this site to clear up the question and for asking it in a basically non-sensational way.