Many ways for prostitution to be (il)legal
Just as today, prohibiting prostitution may mean many different things, such as:
- prohibiting to a woman to give favors in exchange for money
- prohibiting to a man to receive such favors for money
- prohibiting an organized prostitution ring (a cult in biblical terms)
- prohibiting pimping (in the biblical context of one's wife or daughter)
- prohibiting sexual relations outside of marriage
Biblical prohibitions
What makes it more complicated is that these restrictions are different for priests (kohanim) and other social classes. This is relevant for the times of Solomon as then the Jews directly worshiped the Ark of Covenant, and Solomon built the First Temple to house it. For this reason we are also not interested here in Talmudic views on the prostitution, which post-date Solomon time and the destruction of the First Temple.
Since priests are expected to have higher levels of purity, there are specific requirements on their relationships with women, as described in Leviticus 21:7
Leviticus 21:7 prohibits marriage between a kohen and certain classes of women. According to rabbinic law, these classes include divorcees, non-Jews, converts (who were previously non-Jews), and women who have previously engaged in certain forbidden sexual relationships (even if involuntary, i.e. rape). If a kohen did have relations with any of these women, the offspring are described as "profaned" (male: challal, female: challalah); their status is nearly identical to a normal Jew, while the challalah herself is one of the categories which a kohen may not marry.
Curiously, the relevant passage apparently do not specifically mention prostitutes (see here, in French).
Leviticus 19:29 also contains a restriction on prostituting the members of one's own family:
Do not prostitute thy daughter, to cause her to be a whore; lest the land fall to whoredom, and the land become full of wickedness.
Obviously, there is also a prohibition against sex with married women in Exodus 20:17 (one of the ten commandments)
Thou shalt not covet thy neighbour's house, thou shalt not covet thy neighbour's wife, nor his manservant, nor his maidservant, nor his ox, nor his ass, nor any thing that is thy neighbour's.
Who is a "prostitute"?
There is an additional problem of the exact translation of term zonah, which is used in the original passage cited in the OP, 1 Kings 3:16:
אָז תָּבֹאנָה, שְׁתַּיִם נָשִׁים זֹנוֹת--אֶל-הַמֶּלֶךְ; וַתַּעֲמֹדְנָה, לְפָנָיו.
Then came there two women, that were harlots, unto the king, and stood before him.
Although the term is often translated as prostitute/harlot in English, it has more general meaning in terms of engaging in extra-marital relations:
Souvent associé, sans doute à tort, au comportement sexuel de certaines femmes dites de « mœurs légères » ou de « comportement immoral », le terme zonah est traduit, dans la plupart des cas, par « prostituée ». Or, la racine z.n.h. pose un certain nombre de problèmes et sa signification précise est loin de faire l’unanimité. De fait, outre, la prostitution, z.n.h. désigne les rapports sexuels illicites de manière générale, le fait de s’éloigner des commandements de Dieu, de se livrer au culte des idoles, etc. Elle désigne également l’infidélité d’Israël à Dieu ou à ses lois et se décline tant au masculin qu’au féminin. C’est donc à raison que les dictionnaires et les concordances donnent à la racine z.n.h des définitions aussi diverses que les suivantes 3 : scortari ; de idololatria usurpatur ; à zenut : scortatio ; stuprum ; de idolorum cultu ; perfidia (pornea perfidiae) ; et à zenunim : stupra ; scortationes ; de idololatria ; de commercio cum exteris nationibus.
Often associated, no doubt wrongly, with the sexual behavior of certain women known as “loose morals” or “immoral behavior”, the term zonah is translated, in most cases, as “prostitute”. However, the root z.n.h. poses a certain number of problems and its precise meaning is far from unanimous. In fact, in addition, prostitution, z.n.h. refers to illicit sexual relations in general, departing from the commandments of God, indulging in the worship of idols, etc. It also designates Israel's infidelity to God or his laws and is available in both masculine and feminine forms. It is therefore right that dictionaries and concordances give the root z.n.h definitions as diverse as the following3: scortari; of idololatria usurpatur; to zenut: scortatio; stuprum; of idolorum cultu; perfidia (pornea perfidiae); and at zenunim: stupra; scortationes; of idololatry; de commercio cum exteris nationibus.
Prostitution in the Tanakh
Finally, there are multiple episodes in Tanakh/Jewish Bible/Old Testament where prostitutes play positive roles:
The Torah offers several examples of morally ambiguous or even heroic prostitutes — Tamar, who disguises herself as a prostitute and successfully solicits her deceased husband’s father for sex, so determined is she to have a child by that bloodline. Her father-in-law moves to have her burned to death for prostitution, until she reveals that she was the disguised prostitute he slept with. Not only is Tamar praised, Judah looks foolish. Later in the Torah, a non-Jewish prostitute, Rahab, shelters Israelite spies in her home, and in turn is saved when the Israelites ransack the city. The Torah draws one big line with prostitution, in Leviticus: “Do not degrade your daughter and make her a harlot, lest the land fall into harlotry and the land be filled with depravity.”