לרפואת מנחם אלחנן בן בריינדל
לרפואת ר' יצחק בן ברכה
לזכות אסתר ביילא בת רות דבורה
A quick synopsis [hoping that you will read the teshuva in full].
The gemara says that if the husband is in town – בעלה בעיר - there is no problem of yichud. Rashi says that there is no malkus but there is an issur. Tosfos asks from the gemara that relates that Rav Yosef prevented his wife from having yichud when he was in town. The gemara then asks what the problem is if he was in town. But according to Rashi the gemaras question makes no sense. Rav Yosef was bothered because there is still an issur even though there is no malkus. From the gemaras question we see that בעלה בעיר is completely muttar.
There are two issues with yichud. 1] A suspicion of foul play. 2] A דין טומאה and thus the husband is not allowed to live with her. If the husband was mekaney her and she had yichud, she is forbidden to her husband even when he was in town [this is clear from Sotah 2a]. The reason is that it is called "tumah" when she has yichud and we know that ספק טומאה in רשות היחיד is טמא and regardless of how many sfeikos we have there is tumah. That is why Rashi holds that לכתחילה she may not have yichud even if her husband is in town. Not because we really think something happened but because ספק טומאה ברשות היחיד is טמא and the husband is forbidden from living with her [if he was mekaney and if he wasn't they are permitted to each other but the actual yichud is still assur]. Now we have an answer to Tosfos' question on Rashi. Rav Yosef was blind and patur from mitzvos. So he had no issur to live with his wife after she became tamei. So there was no problem on either end – even according to Rashi. As far as her doing something forbidden there is no problem because he was in town. And with regard to the issue of living with her after tumah there was also no problem because he was blind and patur from mitzvos. [The Yerushalmi says explicitly that there is no issur for a blind man to live with his Sotah wife].
The gemara relates that Chana wanted a baby so badly that she "threatened" Hashem that she would have yichud after kinui and drink the sotah waters in order to merit a baby. The Pnei Yehoshua asks how could this tzadekes transgress the issur yichud? But if you read the gemara carefully you see that she said בפני אלקנה בעלי. Since he was around there is no issur yichud. All that remains is that she will be טמאה and have to drink the mei sotah and she will have the baby she yearns for.
But this only works according to Tosfos and Rambam who say that there is no issur at all if בעלה בעיר. But according to Rashi that there is an issur [even though there is no malkus] the question of the Pnei Yehoshua remains. Maybe according to Rashi she meant that she will have yichud with 2 men in which case there is no issur but she still drinks if her husband was mekaney her from these 2 men.
And much much more….
We explained the entire teshuva BS"D in a recorded shiur.