Hadad could have lived out his life in Egypt, but when news reached him in Egypt that King David was dead, he requested permission from Pharaoh to take his family and return to Edom. Pharaoh attempted to convince him to stay where he was, but Hadad refused and still insisted upon going.
We may ask why Pharaoh tried to restrain Hadad? When Hadad left, Pharaoh could repossess the land that he had given him. It is also possible that the queen did not want to lose close contact with her sister and nephew. A third possibility is that Pharaoh foresaw (and wished to prevent) future conflict between Hadad and the new king of Israel, Solomon, who by this time may have already been married to Pharaoh’s daughter.
21 But when Hadad heard in Egypt that David slept with his fathers and that Joab the commander of the army was dead, Hadad said to Pharaoh, “Let me depart, that I may go to my own country.”