Born to a Spanish family in Naples that came to Italy with Charles III of Spain, Carrascosa was, along with his brother Rafaelle, a career soldier. He fought against the French in the Battle of Lodi in 1796, in which he was wounded, but later joined the French-allied Parthenopean Republic. When the short-lived republic fell, Carrascosa was captured and exiled by Bourbon troops. He joined the French forces in the Peninsular War in Spain before returning to Naples, which was now a Kingdom controlled by Napoleon's brother-in-law, Joachim Murat. Murat appointed Carrascosa military governor of Naples and made him a Baron of the Kingdom.