Artix said:
But isn't it better to just use a diode?
Diodes can't make very many colors. They are really only good at making infrared and red.
When you pour the right kind of energy into some materials, electrons in certain shells will absorb that energy and jump up to a new level. When they fall back down to their previous level, they release a photon whose energy is dependent on the specific electron transition. Since the energy of a photon is related to its wavelength, each of these transitions produces a specific characteristic color.
There are a couple of problems with this when it comes to making visible-light lasers: first, to make light 'coherent' you need to be able to trigger the electrons so they all fall at the same time (this is the 'stimulated emission' part of the acronym LASER). Second, and more importantly for your question, there are only so many different ways an electron can switch states, so there are a finite number of wavelengths that can be produced using this property. Making matters worse, only a small portion of those wavelengths are detectable by the human eye.
Frequency and energy are related; it stands to reason that the easiest transitions to make will be the lowest energy transitions. And, indeed, infrared and red lasers have been the most common lasers for a long time. (Note that despite the cultural convention that red is 'hot' and blue is 'cold', red is the lower energy state. You can prove this to yourself by heating something up - what's the first color it turns? Red. And before it emits red, it emits invisible infrared.) Making higher-energy transitions gets more complicated, because an electron that has jumped up multiple levels may choose to jump down in different-sized steps, each of which will produce a different mix of wavelengths. This will prove useful in a minute, when we talk about filtering wavelengths.
So making lasers with diodes, we are limited by the types of transitions that occur, by our ability to stimulate and filter the emitted wavelengths, and by our ability to see certain frequencies. Add these all together and we end up with a situation where it is easy to generate infrared and red, but much harder to generate other colors. Generating other colors requires using a different process than the one occurring in the diode. This is where 'DPSS', diode-pumped solid-state lasers come in.
It's easy to make powerful infrared diodes. 808nm is particularly easy to make. Using 808nm infrared to pump exotic materials like neodymium-doped yttrium aluminum garnet (Nd:YAG) crystals, we can make those crystals emit photons with a wavelength of 1064nm, which is even farther away from the visible spectrum. But then those photons can be sent through a non-linear optical material like KTP (Potassium titanyl phosphate) which has the useful property of doubling certain frequencies. Doubling frequency means halving wavelength, so the KTP emits 532nm, which is a color of green very near to the 555nm peak sensitivity of our eyes.
I left something out of the preceding description, though... remember when I said that higher-energy transitions can take a number of different paths down, each of which will emit a different wavelength? In a green DPSS laser, the Nd:YAG is covered by a filter that reflects or absorbs everything except 1064nm (if it didn't do this, a lot of the 808nm would come through as well as the unwanted wavelengths generated in the crystal). But different filters can be used to pass different wavelengths - Nd:YAG also emits, for instance, 946nm. If we cover the Nd:YAG with a filter that only passes 946nm, the KTP will double that frequency, creating 473nm blue light. Yellow lasers use a similar (though slightly more complex) process, but you get the idea.