on earth or in the world are used as intensifiers for question words.
What on earth are you doing? Where in the world can he be? How on earth did you manage to break that dish? When in the world is the plane going to arrive? Why on earth would anyone do that?