It is meant to humiliate and alienate the wearer. It is actually based on a real situation that involved one of the author's ancestors (he was the magistrate....judge....). The sentence could have been worse as it seems that the actual punishment had been for a while to have the adulterers stoned to death or drown.