In musical terms, temperament is a form of tuning which is a compromise between the natural pure tones of an instrument and the requirements to play either with other Instruments or in many keys or both.
Musical notes are formed in one of five ways. In all cases, a vibration must be caused in some material. This may be:
Of those that have a natural ability to vibrate at more than one pitch or frequency (air and string) there is a simple whole number relationship between the length of the column or string and the note produced. These are called harmonics and are described by natural physical laws.
The original length produces a note called the fundamental or first harmonic). By adjusting the length (either at manufacture or as 'tuning') of the string or column, the fundamental note can be made to be some arbitrary agreed value such as C or D or Bb.
The scales produced by starting on different notes appear to overlap. For example:
-------------------- G A B C D E F# G --------------
The overlap here is A, B, D, E, F# - so these note are the same. Well, no they aren't quite - not on a natural instrument with a fundamental as G or another as A. Some note pairs are quite close but some are far enough apart to jar or beat against each other. This was a problem for ensembles of different instruments and for Keyboard Instruments so some kind of compromise was embarked on.
This natural tuning is called Just Temperament. The compromises are known as Well Temperament and the simplest example is Equal Temperament - used in most modern instruments - where the interval between semitones in a scale is made equal by a mathematical formula (the twelth root of 2). This has the effect of slightly flattening or sharpening some notes but gives a consistent tuning across all octaves and for all intervals in any key.
Equal Temperament made its way to England and Folk Instruments in the mid 19th century. By 1846 it was customary for Pianos to be tuned this way but Organs held took another 10 years before builders started producing equally tempered instruments.
There is another kind of tuning called Meantone Temperament and a variant - quarter-comma meantone is the most often used. When Wheatstone invented the Concertina it originally had meantone tuning. Meantones start as just tempered and then each fifth is reduced (flattened slightly) to a mean or average tuning to accommodate different keys. The tuning is therefore an average compromise.