The Palace’s history started in the Middle Ages when a chapel dedicated to Our Lady of Pena was built on the top of the hill above Sintra. According to tradition, construction occurred after an apparition of the Virgin Mary.
In 1493, King John II, accompanied by his wife Queen Leonor, made a pilgrimage to the site to fulfill a vow. His successor, King Manuel I, was also very fond of this sanctuary, and ordered the construction of a monastery on this site which was donated to the Order of Saint Jerome. For centuries Pena was a small, quiet place for meditation, housing a maximum of eighteen monks.
In the 18th century the monastery was severely damaged by lightning. However, it was the Great Lisbon Earthquake of 1755, occurring shortly afterwards, that took the heaviest toll on the monastery, reducing it to ruins. Nonetheless, the chapel (and its works of marbleand alabaster attributed to Nicolau Chanterene) escaped without significant damage.
For many decades the ruins remained untouched, but they still astonished young prince Ferdinand. In 1838, as King consort Ferdinand II, he decided to acquire the old monastery, all of the surrounding lands, the nearby Castle of the Moors and a few other estates in the area. King Ferdinand then set out to transform the remains of the monastery into a palace that would serve as a summer residence for the Portuguese royal family. The commission for the Romantic style rebuilding was given to Lieutenant-General and mining engineer Wilhelm Ludwig von Eschwege. Eschwege, a German amateur architect, was much traveled and likely had knowledge of several castles along the Rhine river. The construction took place between 1842–1854, although it was almost completed in 1847: King Ferdinand and Queen Maria II intervened decisively on matters of decoration and symbolism. Among others, the King suggested vault arches, Medieval and Islamic elements be included, and he also designed an ornate window for the main façade (inspired by the chapter house window of the Convent of the Order of Christ in Tomar).
After the death of Ferdinand the palace passed into the possession of his second wife Elisa Hensler, Countess of Edla. The latter then sold the palace to King Luís, who wanted to retrieve it for the royal family, and thereafter the palace was frequently used by the family. In 1889 it was purchased by the Portuguese State, and after the Republican Revolution of 1910 it was classified as a national monument and transformed into a museum.
The palace quickly drew visitors and became one of Portugal’s most visited monuments. Over time the colors of the red and yellow façades faded, and for many years the palace was visually identified as being entirely gray. By the end of the 20th century the palace was repainted and the original colors restored.