The area of Sant'Andrea has been inhabited since prehistoric times, as testified by the presence of several nuraghi and other findings. The settlement originated as a Phoenician stronghold, later conquered by the Romans, who had several villas here. In the Middle Ages it was part of the curatoria (shire) of Trexenta within the Giudicato of Cagliari and, subsequently, was owned by the counts of Capraia (1258) and, from 1295, by the Giudicato of Arborea. In 129 it was sold by Mariano II of Arborea to the Republic of Pisa, who held it until the Aragonese conquest in 1353.
It became part of the province of Cagliari in 1821.