Corsica was owned by the Republic of Genoa, and had been for centuries. In the late 18th century an independence movement, supported by the UK, began to gain power and was successful in ejecting the Genoese from the interior and large parts of the coast. Although Genoa hadn't totally lost control of the island, they didn't have the manpower to suppress the interior, and Corsica had become economically unimportant by then, so they hit on the novel idea of selling it to France. In the political equivalent of a fire sale, France purchased Corsica and sent the Comte de Vaux with more than 20,000 troops. After some initial setbacks the French asserted control over the whole island have held it, with minor setbacks, ever since.
The story of Sardinia is a lot simpler. After belonging to Aragon and then Spain for centuries, Sardinia was handed over to the House of Savoy, rulers of what is now Piedmont. Because Sardinia brought with it a royal title, the Savoy lands became known as the "Kingdom of Sardinia" even though Piedmont remained their economic and political base. Sardinia, or Sardinia-Piedmont as it is often better known by historians, was the state that ended up forming the locus of Italian reunificiation, and it was the house of Savoy who became the Kings of Italy, resulting in Sardinia becoming part of the new Italian state.