The term temperament is used in a number of distinct senses, depending on context.
During the common practice period, the term temperament was used to describe a tuning system that slightly compromised the pure intervals of low-complexity just intonation to meet other requirements. Nowadays, a temperament in this sense can also be called a tempered tuning system (often shortened to tempered tuning) to avoid any ambiguity, and it can be designed to approximate any set of pitches.
In regular temperament theory, the term temperament usually refers to a regular temperament, an abstract mathematical structure from which tempered tuning systems can be derived.
In Western music history, the first temperament to be described by theorists was the meantone temperament, in the beginning of the 16th century. It was developed in an attempt to solve some of the issues of the Pythagorean tuning, the most commonly used tuning system until then. In particular, the pure fifths (3/2) are slightly compromised in order to obtain either pure major thirds (5/4), in quarter-comma meantone, or slightly compromised major thirds in other meantone tunings. The linear structure of meantone has laid the foundations for the development of regular temperament theory.
Later in the 16th century, other theorists proposed several equal temperaments, including 12-tone equal temperament (12-TET), 19-tone equal temperament (19-TET) and 31-tone equal temperament (31-TET). Equal temperaments are now often called equal divisions of the octave (EDO or edo) in order to distinguish them from other equal tunings with the same number of notes spanning an interval other than the octave (nonoctave tunings).
Because the previous systems have their own issues, a new kind of temperaments appeared in the 17th century: well temperaments. Their irregular structure allow for more flexibility in the way each note is tuned, and thus how each interval is compromised. As a result, most scales sound different when they are transposed to a different key.