Fretting a string shortens its vibrating length. The fundamental frequency (f) of a stretched string is inversely proportional to its length (L):
f = (1/2L) √(T/m)
Where T = tension (Newtons) and m = mass per unit length (kg/m).
Pressing a string behind a fret reduces L, which increases f, producing a higher pitch. Each fret represents a semitone step, allowing the guitarist to access the full chromatic scale on each string.