These virtues derive initially from Plato's scheme, discussed in Republic Book IV, 426–435 (and see Protagoras 330b, which also includes piety (hosiotes)). Cicero expanded on them, and Ambrose, Augustine of Hippo, and Thomas Aquinas adapted them while adding a set of theological virtues.
The term cardinal comes from the Latin cardo (hinge); virtues are so called because they are regarded as the basic virtues required for a virtuous life. They also relate to the Quadrivium.
The four cardinal virtues appear as a group (sometimes included in larger lists) long before they are later given this title.
Plato identified the four cardinal virtues with the classes of the city described in The Republic, and with the faculties of man. Plato narrates a discussion of the character of a good city where the following is agreed upon. “Clearly, then, it will be wise, brave, temperate , and just.” (427e; see also 435b) Temperance was common to all classes, but primarily associated with the producing classes, the farmers and craftsmen, and with the animal appetites, to whom no special virtue was assigned; fortitude was assigned to the warrior class and to the spirited element in man; prudence to the rulers and to reason. Justice stands outside the class system and divisions of man, and rules the proper relationship among the three of them.
Plato sometimes (e.g., Protagoras 349b; cf. 324e, 329c, 330b, 331a-c) lists holiness (hosiotes, eusebeia, aidos) amongst the cardinal virtues. He especially associates holiness with justice, but leaves their precise relationship unexplained.