One of the earliest documented types of sex work was sacred prostitution--having sex with someone other than a spouse for religious purposes. Sacred prostitutes were sometimes called temple prostitutes because they performed their rituals in temples.
Sacred prostitution has taken a variety of forms, but in Babylon, ancient historians report that each woman was expected to go to the temple of Aphrodite once in her lifetime to engage in sex with a foreigner as a sign of hospitality.