The correct answer is: It sets up the events necessary for the surprising conclusion.
The character in the passage is clearly surprised due to changes in the settings they had previously witnessed before turning around - they did not expect the bodies to emerge from the graves.
Given the surprise factor, the climax transition is set, and this unexpected turn of events leaves the reader expecting further surprises.