Solomon became the son-in-law of Pharaoh, Egypt's king, when he married Pharaoh's daughter. He brought her to David's City until he finished building his royal palace, the LORD's temple, and the wall around Jerusalem.
References for 1 Kings 3:1
Unfortunately, the people were sacrificing at the shrines because a temple hadn't yet been built for the LORD's name in those days.
Now Solomon loved to walk in the laws of his father David, with the exception that he also sacrificed and burned incense at the shrines.
The king went to the great shrine at Gibeon in order to sacrifice there. He used to offer a thousand entirely burned offerings on that altar.
The LORD appeared to Solomon at Gibeon in a dream at night. God said, "Ask whatever you wish, and I'll give it to you."
Solomon responded, "You showed so much kindness to your servant my father David when he walked before you in truth, righteousness, and with a heart true to you. You've kept this great loyalty and kindness for him and have now given him a son to sit on his throne.
And now, LORD my God, you have made me, your servant, king in my father David's place. But I'm young and inexperienced. I know next to nothing.
But I'm here, your servant, in the middle of the people you have chosen, a large population that can't be numbered or counted due to its vast size.
Please give your servant a discerning mind in order to govern your people and to distinguish good from evil, because no one is able to govern this important people of yours without your help."
It pleased the LORD that Solomon had made this request.
God said to him, "Because you have asked for this instead of requesting long life, wealth, or victory over your enemies—asking for discernment so as to acquire good judgment—
I will now do just what you said. Look, I hereby give you a wise and understanding mind. There has been no one like you before now, nor will there be anyone like you afterward.
I now also give you what you didn't ask for: wealth and fame. There won't be a king like you as long as you live.
And if you walk in my ways and obey my laws and commands, just as your father David did, then I will give you a very long life."
Solomon awoke and realized it was a dream. He went to Jerusalem and stood before the chest containing the LORD's covenant. Then he offered entirely burned offerings and well-being sacrifices, and held a celebration for all his servants.
Sometime later, two prostitutes came and stood before the king.
References for 1 Kings 3:16
One of them said, "Please, Your Majesty, listen: This woman and I have been living in the same house. I gave birth while she was there.
This woman gave birth three days after I did. We stayed together. Apart from the two of us, there was no one else in the house.
This woman's son died one night when she rolled over him.
She got up in the middle of the night and took my son from my side while I was asleep. She laid him on her chest and laid her dead son on mine.
When I got up in the morning to nurse my son, he was dead! But when I looked more closely in the daylight, it turned out that it wasn't my son—not the baby I had birthed."
The other woman said, "No! My son is alive! Your son is the dead one." But the first woman objected, "No! Your son is dead! My son is alive!" In this way they argued back and forth in front of the king.
The king said, "This one says, ‘My son is alive and your son is dead.' The other one says, ‘No! Your son is dead and my son is alive.'
Get me a sword!" They brought a sword to the king.
Then the king said, "Cut the living child in two! Give half to one woman and half to the other woman."
Then the woman whose son was still alive said to the king, "Please, Your Majesty, give her the living child; please don't kill him," for she had great love for her son. But the other woman said, "If I can't have him, neither will you. Cut the child in half."
Then the king answered, "Give the first woman the living newborn. Don't kill him. She is his mother."
All Israel heard about the judgment that the king made. Their respect for the king grew because they saw that God's wisdom was in him so he could execute justice.