In 1806, he commanded the artillery of the army stationed in Friuli, for the purpose of occupying the Venetian territory incorporated by the treaty of Pressburg with the kingdom of Italy.
In 1807, he was sent to Constantinople to introduce European tactics in the Turkish service, but this object was defeated by the death of Selim III and the opposition of the Janissaries.
Early in 1811, he was selected by Marshal André Masséna to convey to the emperor the critical state of the French army before the Lines of Torres Vedras.
This commission, though one of great peril — the country being in a complete state of insurrection — he successfully accomplished, for which service he was made general of division.
On the news of the disasters in Russia and Wellington's consequent resumption of offensive movements, Foy was sent with his division beyond Vittoria to keep the different parties in check.
After the battle of Vittoria, at which he was not present, he collected 20,000 troops of different divisions at Bergana, and had some success in skirmishes with the Spanish corps forming the left wing of the allied army.
In March 1815, he was appointed inspector general of the fourteenth military division, but on the return of Napoleon, during the Hundred Days, he embraced the cause of the emperor.