Conquered by the Lombards in 643, the village of Rapallo was included in the county of Genoa under Charlemagne. The name of the city appears for the first time in a document from 964. In 1203 the Podestà of Rapallo was created, and the town became a Genoese dominion in 1229, remaining under that aegis until the Napoleonic Wars. Galleys from Rapallo took part to the Battle of Meloria of 1284. On 5 September 1494, it was captured by the Aragonese, but three days later 2,500 Swiss troops ousted them.

During the 16th century it was attacked and sacked by the Ottomans and Barbary pirates. To help defend the village against such attacks a castle was built on the seafront. In 1608 Rapallo was made into a Capitaneato (captainship) of its own, as part of the Republic of Genoa.

In the late 18th century it was captured by the French who, after several clashes against Austro-Russian troops, in 1805 annexed it to the Apennins region. In 1814 the English freed it, and the following year the city was given to the Kingdom of Sardinia-Piedmont as part of the Duchy of Genoa.