According to 1 Kings 3:16-28, two prostitutes came to Solomon for a judgment over their dispute.
Then two prostitutes came to the king and stood before him... Then the king answered and said, “Give the living child to the first woman, and by no means put him to death; she is his mother.” And all Israel heard of the judgment that the king had rendered, and they stood in awe of the king, because they perceived that the wisdom of God was in him to do justice.
If sex outside of marriage was illegal, why did those criminals openly come to King Solomon? Was Solomon aware of their job?