The season-5 episode "Perfect Week" in the TV show How I Met Your Mother details Barney's mission to seduce 7 different women during a week, without rejection.
Asking about religion and sex in terms of a television sitcom is difficult, as the show does not directly address religious issues; its main goal is to be funny and engaging, and it does that by avoiding controversial topics. A person with strong religious views on sex would probably not watch the show to begin with.
However, Barney's views on sex, while immature, are interesting in comparison with the historical views of sexual relationships. Many of the Biblical and pre-Biblical societies viewed sex both as a necessity to reproduce and as a recreational activity for adults. Barney takes the second stance, avoiding the first one, so in a strictly Judeo-Christian sense the episode would be advocating extra-marital sex without consequences or moral considerations. However, since Barney is not approaching the subject from a religious standpoint, he cannot be said to be subversive as a character; he is acting for himself, not advocating for others.
One thing to recognize is that modern norms regarding sex are far more restrictive -- even "prudish" -- than in prior generations. In Biblical times, both extra-marital sex and prostitution were legal and accepted as part of life; these attitudes changed with the adoption of organized religions, which needed to control sex to avoid intermarriage. Each generation had different attitudes.
Today, Barney's actions are seen as normal by secular society, but they would be condemned by most religions as immoral and harmful. However, since the show makes no reference to religion as a driving factor, it should be seen as secular, not as a direct attack on religion.