The verse says that Pharoah was told "Go to Yosef. Whatever he tells you to do, you should do." Rashi explains he told the Egyptians to undergo circumcision. Why would he do this? Rav Yeruchum Levovitz explains with a verse in Vayigash where the Egyptians said, "You have saved our lives." The Medrash says they were acknowledging his saving them in this world (with food) and in the world to come (with circumcision). It is a spiritual benefit even for gentiles to have circumcision as the orla contains impurity. Rav Yeruchum explains that Yosef had helped them in the physical realm, how could he not help them also in the world to come?
Rav Yehonasan Gefen, The Guiding Light 2, Mikeitz