All kinds of clothing send social messages as to what the person is. For years workmen in Britain wore caps, but foremen (supervisors) wore bowler hats. So, in traditional societies it was expected of a person that he or she would dress appropriately. Other people would know from their clothes what kind of person was on view. That aspect of hats and clothing in general is much less true today.