The Rabbis in the Talmud disagree as to whether a man is permitted to fantasize about other women during sex with his wife. Rabina’s opinion is that it is allowable to fantasize about woman not available in the household or the neighborhood. In modern times, he means by this, a woman such as an actress or a porno star. The point is that sexual fantasy should be about a woman who would not make the person sin in his actions.
Jewish Law is only concerned with actions, not thoughts. To fantasize about a friend’s wife is a dangerous proposition in this sense, because it can lead to sin. Rabina’s commentary implies that fantasies that intensify lovemaking with one’s wife or husband are permissible if–and only if–they remain fantasy.