A guitar makes sounds when we pluck or strum the strings. The hollow body of the guitar amplifies the sounds (makes them louder). Some other string instruments also have a hollow body.
When the strings vibrate, the vibrations pass into the rest of the body of the instrument and come out of the sound hole.
Sound holes are usually different shapes in different string instruments.
The pitch changes with the thickness, length and tightness of the strings.