The first recorded mention of prostitution dates back to 2400 BC. It mentions a brothel temple in Uruk, a city in Sumerian, which today would cover south central Iraq and southern Kuwait. It was run by Sumerian priests. The temple was dedicated to Ishtar, the ancient goddess of love, war and fertility.
There were three grades of women who worked at the temple. One group of ladies were strictly only allowed to perform sexual ritual at temple. The second group of women could enter the temple grounds and offer their services to visits and the last group of women were free to find customers that lived in the city.
There were also male prostitutes that were found wrong in Canaan and Sardinia and Phoenician cultures too. They worked for the goddess Ashtart, who was linked to Ishtar.
Later cultures like the Greek and Romans would take this tradition of scared prostitution and integrate it into their religious practices.