The gemara darshens that the sota waters effectively check the wife only if the husband is clean from sin. rashi explains that it only works if the husband didn't have relations with her after stira. r' shlomo eiger points out that rashi on 47b seems to contradict himself because there he explains like the rambam that aside from being clean from bi'as issur with his wife, he must be clean from all bi'as issur, even from other women who are assur to him for the sota water to work.
i would like to suggest that the gemara actually makes 2 seperate drashos (using the same language). on 28a the gemara is saying that even at times when klal yisroel is zocheh to sota waters checking, it only works if the husband didn't have bi'ah with her aftr she became assur. BUT the gemara 47b is saying like the ramban explains in chumash that klal yisroel are only zocheh to the process of the sotah waters when they are on a high level of shemiras hamitzvos; to the exclusion of a time in history where immoral behavior becomes the norm. therefore, on 47b rashi explains that when husbands in general became involved in znus with either his wife who is assur or any other woman who is assur, the sotah waters stoppe working altogether.