Each fret is a semitone. The instruments are tuned so that the next highest string sounds the same as the one below fretted at the 7th fret. (This means that they are tuned in 5ths.)
G and D are 5 stave notes apart [G-A-B-C-D] but in total, there are actually 7 semitones (frets) [G-G#-A-Bb-B-C-C#-D] with G counting as zero because the mandolin is chromatic and could play those notes which are not in the key of G i.e. G#, Bb and C#). The same applies to each string. Starting on A (second string open) the first 5 stave notes in that key are A-B-C#-D-E but there are the notes for Bb, C and Eb there as well
The notes from the nut to the 12th fret on a string is called an octave and has 12 semitones and 8 notes (since a note can be an interval of 1 or 2 semitones in a set pattern called a mode - hence Octave). The octave note is the same note as the open string but a whole set of notes higher in pitch. The length of the string determines the pitch (frequency) of the basic note (open string). A longer string gives a slower frequency, and hence a lower note. Holding a string down at a certain fret shortens the string and makes it sound higher in pitch. The frets are positioned at just the right interval to ensure that the notes sound correctly and have the right relationship with each other. (This is called the Well Tempered Scale - not all instruments are well tempered - in more ways than one!)
The mandolin family of instruments can be tuned easily by getting the bottom (G) string(s) in tune and then tuning each higher course to the previous string at the 7th fret - they should sound the same. You can get the G in tune from a piano, another musician, a tuning fork or an electronic tuner. (See Tuning)
Middle C on a mandolin is 4th string, 5th fret which gives you some idea of the range of the instrument. Octave mandolins are a whole octave lower, so middle C occurs at 2nd string, 3rd fret.