I think the reason why comments on her hairstyle can be considered as sexual harassment is because they were "an unsolicited appraisal of another person's physical appearance" which is an overt expression of the fact that he was ogling her, i.e. objectifying her.
While saying "ponytail...