In the Middle Ages the town of Altopascio was a centre of assistance along the Via Francigena where pilgrims passed on their way to visit the Volto Santo in Lucca, or directed further afield towards Rome and Jerusalem. Erected around the middle of the XIth century, its Hospital became a place where pilgrims, pregnant women, abandoned children and sick people were received and sheltered. In the XIIIth century its position bordering on the Valdinievole turned Altopascio into a castle with walls, gates and towers. Its decline began in the XIVth century and continued in the following, when Altopascio lost its strategic importance owing to the Florentine occupation of the fortress of Montecarlo.
In the XVth century, the Hospital was transformed by the Florentine Capponi family: the need for new spaces lead to the demolition of many buildings. The cloister was cut by half to make place for a court and the Porta del Giardino was opened. In the following century the Hospital passed under the control of Duke Cosimo I of the Medici family and the direction of Ugolino Grifoni, its master for the next 40 years. It continued in its work of assistance when the Lorena family succeeded the Medici, until Pietro Leopoldo Ist closed the Hospital in 1773.
The first known plan of the walls of Altopascio dates back to the XVIIth century showing a typical Renaissance layout: we lack information on the previous arrangement of the town's fortifications.