For a long time science assumed that sex, sexual habits, sexuality based on pleasure could be traced back to antiquity, which is proved by the records of orgies, group sex, homosexuality, debauchery and all forms of wantonness from the ancient Greece and Roman Empire around the 4-6th century, where virginity of young girls were offered to gods and where prostitution was a recognized honorary profession.
Well, before all this, there was a prehistoric age with some sort of sex, about which science has assumed so far that sex was only a tool of reproduction. Over the past ten years, however, excavations have revealed such 30,000 years old archaeological finds (artificial penises made of stone or horn) that prove that the cave men had sex purely for pleasure. Unfortunately, there is no information on how sex was practiced in the early societies and in smaller, more closed communities (tribes), it is not clear either whether sex had ritual, mystical role.
It has been already mentioned about the ancient times that it was full of lechery. This age was followed by the so-called Dark Ages. The ancient Roman and Greek gods disappeared as well as their sexually overheated and a bit perverse atmosphere (the main god Zeus raped a number of victims, males, females, even children) and the Bible took over the control of sex. In short, the sex was regulated to a minimum level taking place within family for mere reproduction.
Between the 6th and 11th century sex was regulated under the Old Testament. How did it work? For about say 1500 years homosexuality and certain forms of sex (anal, oral sex, masturbation etc. which did not serve reproduction) had become illegal. So much so that sex was allowed only if a couple wanted a child. The Inquisition ensured the compliance with the rules. Of course, the spread of syphilis (17th century) proved that the Christians pursued sex but they kept it private (not like the Greeks or Romans).
Then Renaissance came, when people began to discover again how pleasurable the forbidden things were. The contemporary artists took sexuality again as the topic and the female body started to appear on canvas. This did not mean of course that the antique sex-style was reintroduced, but milder punishment for sex-related offences, for example, women with higher sexual drive did not get burnt for having fun with men.