A friend of mine is a part-time magistrate in Sullivan County, New York. He often hears cases of hasidic men being caught with prostitutes. Moreover, he tells me that the cases of STDs among hasidim in Sullivan County is surprisingly consistent with county-wide infections overall. I was shocked. Many in the frum community are unaware of this, which is unfortunate because it is a serious public health issue. My question: How can these men -- who wouldn't dream of having relations with their wives while nidah -- consort with non-Jewish prostitutes? Isn't a non-Jewish woman also in the class of a nidah? Are they thinking, "if Yehudah could go to a prostitute, it's OK?". I believe that their behavior is 100% wrong, but I understand that some offer a "halachic" rationale for their illicit behavior. What, if anything, could they possibly argue?
The premise of your question seems to be that ostensibly religious people never sin, which is obviously absurd. These men are sinners, who are acting in violation of Jewish law, and if their behavior ever became public knowledge, it would scandalize their communities.
The simple reality is that sexual immorality is not, and never has been, exceptional or unusual. Sexual sin exists in every human society, and the Orthodox Jewish world is no exception. Maimonides writes (Hil. Issurei Biah 22:18-19):
There is nothing in the entire Torah that is more difficult for the majority of people to separate themselves from than sexual misconduct and forbidden relationships. ... You will never find a community that does not have some people who are promiscuous regarding forbidden relationships and prohibited sexual conduct.
First of all: the behavior you describe is wrong. Let's make that entirely clear.
I can think of two-and-a-half justifications people may use, to better understand the phenomenon (if it truly is a phenomenon).
1a: Halachically speaking, the Biblical prohibition of "nida" per se only applies to Jewish women. (See Rambam Issurei Biah 4:4). (Rabbinically, all gentile women are automatically nida as well, but that's at the rabbinic level.) It would appear that the Torah was focused on conduct within the Jewish community; it was so crazy for someone to go outside it that it never bothered to apply these prohibitions there.
1b: As a corollary, this could (if read sideways through a giant ton of personal bias) lead someone to believe that Judaism only cares about how you deal with other Jews; anything to do with a non-Jew somehow "doesn't count for real." G-d forbid! But I could see how someone could think that.
2: Rabbi Aaron Rakkefet-Rothkoff has suggested that in certain circles of certain Hassidic communities, there is little legitimate room for honest intimacy (at the emotional or physical level) between a husband and wife, due to ideas of "modesty" and "holiness" taken to some rather sharp extremes. Just as the Talmud discusses (with horror) a lifestyle whereby one wife is "for procreation" and one is sterilized and used "for pleasure", a misguided individual could conclude that his respectable, publicly-appropriate wife gives him no opportunity whatsoever for physical enjoyment -- and nor could or should she; therefore he goes for something "on the side."
The remedy for this, obviously, is for the community to validate a strong, two-way relationship (emotional, spiritual, and yes, physical) between spouses. When the Talmud applies "love your peer as yourself" to your spouse, that's a subtle reminder that while that person of the opposite gender has some different laws in Judaism, she is still a human being, and she is still your peer.
Once again I can't begin to defend any such actions (which I hope are rare); but I think this may explain the mentality behind them. And of course, humans are very complex creatures and their desires can lead them into some very strange thinking and behaviors.