וַיִּתְחַתֵּ֣ן שְׁלֹמֹ֔ה אֶת־פַּרְעֹ֖ה מֶ֣לֶךְ מִצְרָ֑יִם וַיִּקַּ֣ח אֶת־בַּת־פַּרְעֹ֗ה וַיְבִיאֶ֙הָ֙ אֶל־עִ֣יר דָּוִ֔ד עַ֣ד כַּלֹּת֗וֹ לִבְנ֤וֹת אֶת־בֵּיתוֹ֙ וְאֶת־בֵּ֣ית יְהוָ֔ה וְאֶת־חוֹמַ֥ת יְרוּשָׁלִַ֖ם סָבִֽיב׃
Salomo verschwägerte sich mit Pharao, dem König von Ägypten. Er nahm die Tochter Pharaos zur Frau und brachte sie in die Stadt Davids, bis sein Haus und das Haus des Herrn und die Mauern um Jerusalem fertig waren.
Rashi
Shlomo became the son-in-law. As long as Shim’i, his teacher, was alive, he did not enter into marriage [with Pharaoh’s daughter]. From here, [our Sages derived and] declared, that a person should always live in the vicinity of his teacher.1Based on the juxtaposition of Shimi’s death and Shlomo’s marriage to Pharaoh’s daughter. See Maseches Berachos 8a.2In order to remain under his teacher’s guidance and influence.
Rashi
Until he finished building, etc. And afterwards he built a house for her.3Alternatively, after he finished building the Beis Hamikdosh, Shlomo moved Pharaoh’s daughter out of the City of Dovid which had become sanctified by the presence of the Ark.—Radak