While you're mining rocks, the stability will decrease. Mining stronger rocks as well as pillars will result in the stability to decrease faster. As soon as the stability meter goes beyond red, two things may happen.
The ceiling will collapse. If you stand still during the cave-in, you will not receive 10 damage. You have to dig away the rocks that fell down to continue. You can also run away really quick to avoid having to do so. In the picture below, you see a total of 8 blocks that fell down from the ceiling. The eighth block fell on a mummy, thus destroying it as well as itself.
Lava can also appear, in which case you have to run away from it. If you stand next to the lava, you will receive 10 damage. You have to wait for it to cool down, before you can dig it away. In some levels, the lava will continue to appear until it cannot further spread. It is best to stop the lava by taking 10 damage in that case.