Steve asked about a Nazir, and Joe responded, in the way I would have. I would like to flesh out Joe's final remarks, but this discussion requires some setup, in addition to which I'd like to bring out a few points I find interesting, so off we go.
A Nazir is an individual who takes upon themselves special vows of abstinence from wine, cutting the hair and contact with a dead body, which is a source of spiritual impurity. We learn about the nazir in connection with the sotah, the wife who is suspect of adultery.
In parshas Naso, we are given the laws of the sotah, and Rashi bring in a wealth of commentary. One of the spectacles to which the sotah is exposed, in order to compel her to perform teshuvah, repentance (which will save her life if she is guilty), is that she is progressively humiliated - first her hair is uncovered publicly, then she is stripped naked down to her waist in front of a crowd of onlookers. Needless to say, for a people who essentially gave the world our present notions of modesty (at its best, not Islamist cutting off heads for showing an ankle "modesty"), these are grave impositions of the public into the private.
Just to finish the thought, after this the sotah is forced to drink a mixture containing a powdered scroll, on which certain text is written. If she is guilty then, well, her womb explodes and she dies there and then. Until the very point she actually drinks the mixture, she can repent and her life will be spared. If she is innocent and the potion has no effect, she is cleared of all charges and accusations, declared a righteous woman, promised (by G-d, not by men) many strong children and becomes a heroine, a true aishes chayil (woman of valor), her name being given to newborn girls throughout the land. Most importantly, her husband now becomes her personal slave, figuratively speaking, can never divorce her, and must service her every wish. So, in terms of a normal Jewish marriage, as far as I can tell, nothing changes!
The parshah, having completed describing the sotah's fate, breaks off and continues with the laws of the nazir. When two sections in the text are so juxtaposed, there is a relationship between them. Rashi brings it down that the people who witnessed the spectacle of the sotah, the ones who stood in the crowd of onlookers, should take on themselves the nazirite vow, which as I wrote before consists of abstinence from wine (or anything to do with grapes, really), cutting the hair on the head, and contact with a dead body. I don't know how the term of a nazir, the length of time they are to adhere to these vows, is determined. There were probably customs how to determine this, and certainly experts could be asked, it being the Temple courtyard.
There is an interesting question that I had in relation to all this some years back. The sotah was stripped down in the Temple courtyard, which was always full of people going to and fro, bringing in their various atonement and thanksgiving offerings and the like. A person could find themselves in the Temple courtyard walking past such a spectacle involving a sotah purely by chance. In such a case, why should they be punished for it? The essence of a nazir is achieving a high level of separation or purity (equal to, and even above the level of the High Priest himself!) through abstinence from pleasure (wine) and comfort (hair cutting). It was not their decision to witness a sotah's humiliation, mind you, it's likely they were just passing by. Maybe they merely glanced to see what the commotion was all about and kept walking. For this they must take on such an extreme obligation? It is a very extreme obligation, which may not seem obvious at first, so let's develop some context.
As I said, I don't know how the term of a nazir was determined, but I have read of it being five years. In one case, a nazir near the completion of their term slipped and fell down a ravine and on top of a dead body, which had been dumped there by murderers. So, their term began from the beginning! In another case, the term began anew twice. Imagine if someone really doesn't like you and knows you have two more days to complete a ten year nazirite term. All they have to do is hold you down and force a grape in your mouth, and you are forced to start from the beginning. I'm playing it out to the extreme, but this is dangerous business, to be taking on such an oath, as by decree of heaven (i.e. events not within your control) you may never be free of it.
Flipping this around on its head, the sotah's test can only be fulfilled when she is humiliated before a crowd of people. In other words, these spectators are a necessary part of the process; they're performing a much needed service, without which the sotah's fate, which rests on her choice to admit her adultery, to not admit her adultery, or to stand confident in her valor, cannot be realized. I should mention, the sotah's outcome is not relevant to the onlookers. Whether she is cleared of the charges, repents her wrongdoing or drinks the potion and dies, the obligation to take on the nazirite vow holds.
So, which is it? How can these spectators be both valued participants, on whom the process depends, while simultaneously worthy of punishment, if we can call it that, for their participation?