Frets are metal wires embedded into the fretboard of the fretted instrument and held in place by the slight bowing of the neck under the string's tension. Their purpose is to facilitate the accurate playing of notes and chords. When the string is pressed between them it vibrates from the fret rather than the finger's position on the fingerboard, as with the violin, viola and orchestral bass

They are usually placed 1 half tone apart down the neck, so the eighth note (or octave) is often referred to as the twelfth fret by guitar players.

It's possible that if one removes the strings from, say for example, a guitar or banjo entirely, the frets will become slightly dislodged and shift sideways, making the playing of said guitar a lot less comfortable.

Highly necessary on guitars and like instruments, both acoustic and electric, (because either would be completely unplayable without them), they are slightly less necessary on the bass guitar, unless you want the sound of steel slapped against steel.

Other fretted instruments include the:

There is also the family of viols (an antiquated form of violin or cello) which used "cat gut" tied around the neck rather that the more modern bronze or steel wire.