Shuttlecraft exit the shuttlebay by leaving through a set of large doors that lead to the exterior of the starship. When the doors are open, the environment in the shuttlebay is protected by a large forcefield so no atmopshere can escape. (TOS episode: "The Galileo Seven").
Constitution class starships had one shuttle bay, located at the rear of the secondary hull. Refitted Constitution class ships had two large elevator pads built into the floor of the shuttle bay, which were designed to raise and lower shuttles to and from the shuttlecraft maintenance area below the shuttle bay. (TOS reference guide Mr. Scott's Guide to the Enterprise).
When not launching or receiving craft the space doors for a shuttlebay are usually closed. When they are opened a force field is deployed over the opening, which can be penetrated by shuttles as the launch and are recovered without compromising the atmosphere within the bay itself.