The site was first fortified during Aragonese rule in 1495, when the Kingdom of Naples was threatened with imminent invasion by the forces of Charles VIII of France. Alfonso II of Aragon persuaded Frederick, Duke of Montefeltro, to send him the most renowned military engineer of the age, Francesco di Giorgio Martini, a native of Siena. He put him in charge of reinforcing the defences throughout the kingdom, with responsibility for both the overall project and the design of individual fortresses such as this one.
As part of a system covering the whole territory, the castle of Baia ensured control of the bay of Pozzuoli and prevented enemy vessels sailing in and landing troops which could have attacked Naples itself from the rear. In the years 1538 to 1550 the Spanish viceroy Pedro di Toledo carried out extensive rebuilding works on the Aragonese castle, strengthening and enlarging it until it took on the aspect we know today.
It continued to serve as a fortress under Spanish and Austrian domination (1503 -1734) and also during Bourbon rule (1734 -1860). With the unification of Italy, up until 1887, it fell into disuse and a state of disrepair. In 1927 it was made over in perpetuity to the Royal Military Orphanage, and during the next three years was extensively altered and built onto to adapt it to its new function. The castle continued to house the orphanage until the suppression of this institution in 1975. (cnr.it)