to maintain the order of the world
established at the time of creation.
The fact that Pharaoh would consult this foreigner shows the level of his concern over this matter.
Some resources about the Egyptian worldview:
(Note: I am not an expert in Egyptology, but these articles provided some interesting ideas for thought)