Young King Solomon (at the age of 12) won the heart of the Jewish People by his Divinely inspired judgment of the two prostitutes.
In the Biblical account of the judgment of Solomon there is no mention that prostitution is illegal in the Torah. Why?
The mark of a righteous and wise king is his special sense of mercy and compassion towards the lower classes of his people.
First he ordered that the infant under dispute be cut into two. This reflects the attribute of severe judgment, the mentality of prostitutes.
But his underlying intention was to convert apparent severity into compassion, that of the true mother for her child and his towards her.
Not only did the true mother receive her child, but King Solomon clarified, in the world of prostitution, who is inhuman and who is human.
The human, compassionate prostitute is the one who was captured and is trapped in evil, a holy spark for the king is to redeem.
The sign of a king worthy to rule over Israel is his ability to perform justice and clarify the reality of immorality within his domain.
For sure, the prostitute that won became a "chosid" of Solomon, and most likely, due to the Divine revelation in the court, so did the other.
The story of Solomon and the prostitutes immediately follows his asking God to grant him wisdom to judge the people. God answers his request.
From this we learn that kingly wisdom is how to deal with prostitution, how to elevate fallen sparks trapped in the underworld.
In a certain sense Solomon reached the highpoint of his life at the age of 12, becoming a conduit to manifest Divine wisdom and compassion.
He went on to marry 1000 wives, princesses of foreign countries. Here he erred. The sages differ as to his intentions, holy or profane.
Even according to the opinion that he had good intentions, to elevate the fallen sparks amongst the nations, he disobeyed the Torah and fell.
A righteous kingdom begins with justice and rehabilitation of the lowly and unemployed, of those who have fallen to immorality.
In Kabbalah, justice and compassion go together, both are properties of tiferet, "beauty," they reflect the innate beauty of the soul.
After justice and rehabilitation come education, economy, and health care, and then security – peace, ideally without the need for war.
In chess, a game attributed to King Solomon, the queen moves more freely than the king. In reality, the queen motivates the king.
We shake the lulav 18 times, 3 to each of the 4 lateral directions, 3 up and 3 down. So the Torah allows a king to marry 18 wives, no more.
King David first married 6 wives (who motivated him to expand to all sides). Then God told him that he may have "as these and as these" – 18.
King (90) plus 18 times woman (306) = 5598 = 18 times man (311). This relation works only for 18. His wives make him a man, a man of action.