Craters may be formed in two ways. They may be formed when a volcano erupts, or they may form when the surface is hit with a lump of space rock called a meteoroid. The craters on a planet or moon may be formed in either of the two ways.
The video below shows lava erupting from a crater on Hawaii.