The ceiling of a cave is the base of the ground which you stand on. Water seeps through the soil and reaches the cave ceiling. The water then drops from the ceiling. The water while seeping down carry minerals present in the soil. Now the minerals collect and grows around the area where the water falls on ground of the cave. These are called stalagmites.
This process is the same for formation of stalactites.