Pharaoh recognized Joseph as one who had unique supernatural powers ( Genesis 41:38; cf. Daniel 5:14). He probably did not identify the "spirit" in Joseph as the Holy Spirit, the third person of the Trinity. There is no evidence that Pharaoh understood or believed in the God of Israel much less comprehended his triunity. Most likely he thought some deity had manifested himself or herself through Joseph. [source][source][source]
It was not unknown in Egypt for the Pharaohs to appoint individuals who lacked previous social station or political rank to positions of authority in the government. [source][source][source]
"At any time the king would-and did-appoint outsiders. In fact, the noteworthy careers, as preserved for us in tomb inscriptions, broke through all departmental limitations. Men of humble origin could rise to the top once their gifts were recognized; and we find that they were called to a succession of posts which would seem to us to have required entirely different preparatory training." [1][source]
To naturalize Joseph, Pharaoh gave him an Egyptian name ( Genesis 41:45; cf. Daniel 1:7) and an Egyptian wife from an appropriate level of society. Joseph"s father-in-law was evidently a high-ranking priest in the celebrated temple of the sun located in the city of On (Gr. Heliopolis) 10 miles northeast of modern Cairo. [source][source][source]
"The high priest at On held the exalted title "Greatest of Seers." Joseph thus marries into the elite of Egyptian nobility." [2][source]
Joseph"s marriage to an Egyptian seems to have been Pharaoh"s order, and God permitted it. The patriarchs generally avoided marrying Canaanites because of God"s curse on Canaan ( Genesis 9:25), but marriage to non-Canaanite Gentiles was less serious. Joseph"s wife and in-laws did not turn him away from his faith in Yahweh or his high regard for God"s promises to his forefathers (cf. Moses). [source][source][source]