Note: I suspect that the following ramblings may be adapted to any kind of sandbox - be it a Megadungeon, a huge wilderness area, a space sector, etc.
If you've been following the so-called OSR for a while you surely remember this post over at Greyhawk Grognard (also author of the impressive Castle of the Mad Archmage Megadungeon). If not, well, do yourself a favor and go read it right now. Done? Good, let's move over. So we all agreed that a Megadungeon should be not considered merely as something that is there to explore, but also the very center of the campaign you're playing around it. This is very convenient from a
Try to look at the Megadungeon as an un-exploded bomb. It's there since forever, it probably has a long history, and many secrets to unearth. But what happens when you unearth those secrets? What happens when you poke the proverbial sleeping dog? We're not just talking about "if you slay the orcs of tribe A till the last motherfucking one of them orcs of tribe B are very likely to move in the western section of the level". We're thinking BIG out here. For example, in the Megadungeon I'm developing lately, one of the lower levels is home to a dragon everyone believes dead. Even more, the descendants of the supposed dragon slayer are using their ancestor's heritage to tyrannize the lands around the Megadungeon. What would happen if the party goes down in the cave looking for the dragon's hoard, and discovers that the beast is still alive? What if they awake the dragon? Also, a covenant of wizards has taken residence in the black tower that the Witch King built near the dragon cave and are trying to re-settle things in order for their master to return. Will they lose time and resources fighting the dragon, or gain a powerful ally? And so on.
As you can see, I'm not talking about timed events: I'm talking about triggers left here and there to allow the players to take meaningful choices (a term which can never, ever be over-emphasized in sandbox games), which creates conflicts, which actively shape the story.