Answer
A more advanced treatment of waves in strings shows that the wave speed depends on the tension and on the mass per unit length of the string.
Work Step by Step
On a guitar, the different strings have different tension, and different mass. For waves, the wave speed equals the frequency multiplied by wavelength. Changing the wave speed while keeping wavelength the same means that the frequency/pitch is affected, which was the goal.
Furthermore, a guitar player can press the string onto a fret in the neck of the guitar, changing the length and the wavelengths of vibration, which is a way of changing the frequency on the fly.