The mountain material is solid and strong enough not to collapse the hole, or the hole is lined with reinforcement that transfers load from one side to the other. This is now iron/steel rings or reinforced concrete. Tunnel boring machines build the liners as they progress, and push forward using the last ring.