Imaginea closed box with perfectly reflecting walls, and an electromagnetic field (light) inside. Such a box is called a cavity. Under certain conditions, stable configurations of the field, called modes, may emerge, and sustain themselves forever. In practice, cavities are almost never closed boxes. Side walls are removed, and all that is left is two reflecting mirrors facing each other. The reason for that is that one wants to eliminate all modes but a few longitudinal modes. Each longitudinal mode is a standing wave pattern, which can be thought of as a collimated beam bouncing back and forth between the two mirrors, with a well defined field frequency. In addition, one of the mirrors is indeed perfectly reflecting (called "rear mirror"), but the other one is purposely made partially reflecting and partially transmitting. Thus, each time light inside the cavity impinges on this mirror (called the "output mirror"), a fraction of the light escapes the cavity, and constitutes the laser beam. Of course, such an energy depletion must be compensated for by depositing replacement energy into the cavity ("pumping").
Laser cavities are also often called "resonators".