The fifth perek of Massekhet Sota, which began with the Mishna on daf 27b, is a collection of homiletic interpretations of a number of biblical passages. The thread that holds these interpretations together is the fact that they were all said bo ba-yom – “on that day” – which is to say, on the day that Rabbi Elazar ben Azaryah was appointed to the position of nasi of the Sanhedrin (see Masseket Berakhot 28a).
The first of these teachings relates to the laws of Sota, where we find that Rabbi Akiva learns from passages in the parasha of Sota (see Bamidbar 5:12-31) that the “bitter waters” examine not only her behaviors, but his, as well. Although the pronoun is unclear, our Gemara concludes that when Rabbi Akiva says that the “bitter waters” examine “his” behaviors, he must be referring to her lover and not her husband. That is to say, if the woman had, in fact, committed adultery, not only would she die the horrible death described in the Torah, but the man with whom she committed adultery would suffer that death as well. It cannot be understood as referring to her husband – i.e. that her husband would be punished if he had been unfaithful or committed some sexual crime – because the Sages had a tradition, based on the last pasuk in the parasha (Bamidbar 5:31), that if the husband had committed such a crime, the “bitter waters” would simply be ineffective.
According to the Rambam (Hilkhot Sota 2:8), this rule applies to any sexual misdeed. If at any point in his life the husband engaged in a sinful sexual act, the Sota ceremony will not work on his wife. Many of the commentaries disagree with this position, ruling that it is only if the forbidden act related to his wife that the “bitter waters” would have no effect. In his commentary on the Torah, the Ramban argues that this rule applies to the entire family, so that if anyone in the family had transgressed a sexual prohibition, the waters would not work.