1520s, "to offer to indiscriminate sexual intercourse" (usually in exchange for money), from Latin prostitutus, past participle of prostituere, etymologically "place before or in front," hence "expose publicly," and especially "expose to prostitution."
This is from pro "before" (see pro-) + statuere "cause to stand, establish" (from PIE root *sta- "to stand, make or be firm"). Related: Prostituted; prostituting. Figurative sense of "surrender to any vile or infamous purpose" (of abilities, etc.) is implied from 1570s.
"harlot, woman who offers her body indiscriminately" (usually for money), 1610s, from Latin prostituta "prostitute," fem. of prostitutus "exposed publicly," adjectival use of past participle of prostituere "expose to prostitution; expose publicly" (see prostitute (v.)). No distinction in the use of the word was made between women who did so to gratify themselves, those who did so out of necessity, or those who were forced unwillingly to it.
It was somewhat earlier used in English as an adjective, "offered or exposed to lust" (1570s), earlier still in the figurative sense of "debased, devoted to vile or infamous purposes" (1560s).
The notion of "sex for hire" is not inherent in the etymology, which rather suggests one "exposed to lust" (by herself or another) or sex "indiscriminately offered." Descendants of the Latin word are now almost the official European term for the institution: German prostituierte, Russian prostitutka, etc.
Of men, in reference to homosexual acts, by 1886 (implied in a use of prostitution); the phrase male prostitute is attested by 1948.