Radicalized governments in Pakistan and Egypt would be one scenario. The other might be that Iran manages somehow to set off a nuclear detonation in Israel, and Israel nukes the Middle East.
There could also be alliances formed with Russia or China or the even the EU. History is full of odd twists and turns.
While many things are possible. They are not likely.
If nukes start going back and forth the rest of the world will get as far away as possible.
As far as Israel goes, it really has only two primary targets in any kind major exchange like that. Iran and Syria. And on that list only Iran is worth a nuke.