It's actually quite a beautiful control mechanism when you think about it. One thing you know 99% of people have is a sex drive, and if you focus or indeed as some denominations do control how and if they can express it you've got a great deal of influence over them.
That and our ancestors had some pretty weird ideas about procreation that made them think non-procreative sexual pleasure was bad. Aristotle (the ideas which some Catholic and even some of the more right wing fundamentalist ideas about procreation are still based upon) thought that sperm contained small fully formed humans, and to jack off was to kill innocent people.
It's not all based on religion, a lot of it is just really bad science.
That and our ancestors had some pretty weird ideas about procreation that made them think non-procreative sexual pleasure was bad. Aristotle (the ideas which some Catholic and even some of the more right wing fundamentalist ideas about procreation are still based upon) thought that sperm contained small fully formed humans, and to jack off was to kill innocent people.
It's not all based on religion, a lot of it is just really bad science.