The king of Egypt had attacked Gezer and captured it, killing its inhabitants and setting fire to the city. Then he gave it as a wedding present to his daughter when she married Solomon,
Solomon made an alliance with the king of Egypt by marrying his daughter. He brought her to live in David's City until he had finished building his palace, the Temple, and the wall around Jerusalem.
Solomon's own quarters, in another court behind the Hall of Judgment, were made like the other buildings. He also built the same kind of house for his wife, the daughter of the king of Egypt.
Solomon filled in the land on the east side of the city, after his wife, the daughter of the king of Egypt, had moved from David's City to the palace Solomon built for her.
But they did not drive out the Canaanites who lived in Gezer, so the Canaanites have lived among the Ephraimites to this day, but they have been forced to work as slaves.