It protected Egypt from foreign invasions: the desert was practically impenetrable, which means that any possible invasion could only come from a place they could expect (and prepare for): the along the Nile or from the sea.
Knowing that they don't have to fear foreign invasions meant that Egyptians could focus on growth and culture.