In this paper, we discuss the generation of short laser pulses with the gain-switching technique in a solid-state laser. These are used in the field of processing technologies as well as in medicine, and their generation requires stability and repeatability at arbitrary times. The transient phenomenon when the laser is switched on is the basis for the gain-switching technique and is described in the beginning. Further in this paper a theoretical model for predicting laser pulse duration is presented. The experimental part includes the analysis of two laser system configurations. The first configuration is optimized for the emission of light with a wavelength of 1064 nm, and the second one for the light with a wavelength of 532 nm, which was generated by second-harmonic generation. By measuring relaxation oscillations and gain-switched laser pulses, we verify and confirm the theoretical model for pulse duration and test the ability of short pulse generation. In the experiments we achieved pulse lengths of 15 ns and peak power up to 125 W for 1064 nm light and lengths of 33 ns and peak power up to 73 W for 532 nm light at pumping peak powers of 22 W. A pulse energy stability under 3,2 % was measured for trigger frequencies between 1 kHz and 100 kHz, suggesting the potential use of a laser system in applications in which pulses are triggered at arbitrary times.