When a man’s wife is ritually pure and he intends to be intimate with her that night, he may think about things that stimulate his desire for her, for there is no concern that these thoughts will lead to a nocturnal emission. However, when she is ritually impure or they are apart from each other, he may not think thoughts that will stimulate his desire for her, lest he will have a nocturnal emission. Even while his wife is pure, a man should be careful not to read or watch anything likely to cause sinful thoughts, i.e., lusting for sin or thinking thoughts that impair his love for his wife.
So that a man does not sin or think sinful thoughts, the Sages established safeguards for when his wife is a nidda: not to play or be frivolous together, not to smell the perfume on her body or clothes, not to gaze at the parts of her body that are normally covered, not to hand things to one another, not to eat alone at a table without some kind of indicator to remind them that they are prohibited to each other, not to eat from the same plate, and not to drink food that she left in her cup or on her plate. He should not sit or lie down on her bed unless she is out of town, and she should not make her husband’s bed in his presence (SA YD 195).
So that a man does not think sinful thoughts, he may not engage in any activity that will arouse his urges, that is, that will cause him an erection or to have enduring thoughts about a specific woman. Therefore, he should stay away from places and situations where immodesty abounds and which are likely to arouse his urges. However, sometimes this is necessary to make a living, such as by attending college classes in a framework that does not conform to the halakhic parameters of modesty. In such a case, if he has the option of studying the same profession in a modest framework, he must do so. But if there is no possibility of learning the profession that is appropriate for him in a modest framework, he may study in an immodest framework, as long as he estimates that his urges will not overpower him. If he is uncertain, or in pressing circumstances, he should consult a wise rabbi.
It must be mentioned that it is impossible to set parameters for all of these matters, because people are very different. As the Sages tell us, if someone knows that he has subdued his evil inclination and has it under control, he may be lenient in situations where others would be required to be stringent. For example, R. Gidel would instruct women how to immerse properly in the mikveh, saying that at that moment, the women resembled white geese to him (Berakhot 20a). Likewise, R. Yoḥanan knew that women leaving the mikveh wanted to gaze at him so that they would have sons as beautiful as he was. He therefore sat at the entrance of the mikveh without concern about his evil urge (ibid.). Similarly, at weddings, R. Aḥa would put the bride on his shoulders and dance with her in order to make the bride and groom happy, saying that he found this no more stimulating than carrying a wooden beam on his back (Ketubot 17a). In contrast, other Tanna’im and Amora’im were very concerned about their urges. For example, Abaye once watched a man and a woman take a long walk together and not sin; he assessed that had he been in that situation, he might have sinned. Abaye felt very bad about this until an old man reassured him that this did not indicate any inferiority. On the contrary, “The greater a person, the greater his urges” (Sukka 52a). R. Ḥiya bar Ashi, even in his old age, would pray that he not succumb to his evil urges. Once, his wife, seeking intimacy with him, disguised herself as a prostitute. He desired to sin with her, and even after she revealed that she was his wife, he fasted over it for the rest of his life, since he had intended to sin (Kiddushin 81b). Additionally, regarding the prohibition of yiḥud, R. Meir said, “Make sure that I am not secluded with my daughter,” and R. Tarfon said, “Make sure that I am not secluded with my daughter-in-law” (ibid.).
Since a person can deceive himself, Rishonim and Aḥaronim write that one should not trust himself in this area unless he is particularly pious and self-aware (Ritva, Kiddushin 82a; Smak §30; Yam Shel Shlomo, Kiddushin 4:25; Pitḥei Teshuva, EH 21:3). Sefer Ha-ḥinukh is more stringent, explaining that the Amora’im who were lenient for the sake of a mitzva were angelic, “but today, we may not breach even the smallest safeguard in this area” (§188). This is the generally accepted approach. Nevertheless, within reason, in a situation where many people can control themselves, this question is left to the discretion of the individual. The more susceptible he is, the more stringent he should be.
It is also important to be aware that in everything pertaining to sexual arousal, there is a big difference between younger people and older people. By nature (physically and psychologically), younger people are much more easily aroused, so they must safeguard themselves better. Similarly, an unmarried man must be more careful than a married man, since he cannot yet express his desires through the sacred covenant of marriage.