Piombino is strategically located along the coast, facing a semicircle of seven islands in the Tuscan archipelago. Its name appears for the first time in a document dating to 1115, but historians date its origins to the year 809 when the historic settlement of Populonia was razed to the ground by the last incursion of Greek Saracens from the north. These marauding bands destroyed what little remained of the Etruscan site and enslaved the local population, although some managed to escape southward, finding refuge in the surrounding forests where there was an ample supply of water. In 1022 six brothers of what would later become the prominent Della Gherardesca family founded the Monastery of San Giustiniano di Falesia on a hill overlooking the natural harbor of Falesia, today known as Portovecchio. Until the second half of the 12th century the promontory of Piombino formed part of the legacy of Saint Peter, and the town was governed by the abbot of the monastery.
For a certain period Piombino was a free comune, but in 1233 it was annexed by the Maritime Republic of Pisa, becoming its second largest town and its second port. The fortunes of Piombino followed those of the republic before, during and after the succession of Signorie who ruled the republic until the end of the 14th century. At that time Gherardo Appiani became Signore and ceded Pisa and its territories to Gian Galeazzo Visconti, maintaining for himself a section of the coast to the south comprising Populonia, Suvereto, Vignale, Scarlino, Buriano, Badia al Fango, and the islands of Elba, Pianosa and Montecristo, with Piombino as its capital. The Signoria di Piombino was transformed into the Principato di Piombino in 1594 and managed to maintain its independence (despite various turbulent periods) for more than four centuries, until 1815 when the Congress of Vienna re-divided Italy and its territories were added to the Grand Duchy of Tuscany under the rule of the Hapsburg-Lorraine dynasty.
Leonardo spent two periods in Piombino, first in 1502 as the military engineer of Cesare Borgia Il Valentino (signore of the territory from 1501 to 1503), and then in 1504 following complex diplomatic negotiations in which Niccolò Machiavelli participated. Indeed, Machiavelli traveled to Piombino to represent the interests of Florence, which sought to establish closer ties with the local Signori in order to ensure that it would always have access to the sea and be able to protect its own commercial and military interests. During his first sojourn Leonardo had ample opportunity to explore and survey the town and its surrounding territory. His second visit lasted just two months and he concentrated on projects to improve the town and its defenses.
During its four centuries as an independent municipality, Piombino was ruled by the Appiani, the Ludovisi, the Boncompagni-Ludovisi, and finally Princess Elisa Bonaparte-Baciocchi, the sister of Emperor Napoleon I. It was regarded with jealous interest, however, by Italian and foreign powers given its strategic position on the Tirrhean coast, and for economic reasons because valuable tin mines were located on the island of Elba, which it leased out for the manufacture of arms.
Shortly after the unification of Italy, in 1865 the first iron and steel works were established in the harbor of Portovecchio, which raised Piombinoi to the position of one of the most important sites of steel production in Italy. A massive migration of workers and technicians from different parts of Italy resulted in an expansion of the town, which up to then had remained delimited by its medieval and Renaissance walls, and during the early decades of the 20th century Piombino was the fastest growing city in Italy.