"France is strong when it unites around the essentials, above differences and disputes," Valls declared at the unveiling of a monument to the battle at Mondement, east of Paris.
Drawing a parallel between the country's current problems and the hardships of war, the prime minister warned an audience of school students against the "chaos to which populism and nationalism lead".
Earlier he was at the recently opened Great War Museum in the city of Meaux, whose mayor, leading right-wing MP Jean-François Copé, declared himself happy to welcome the prime minister "in a spirit of unity".
President François Hollande was absent from this fourth national ceremony to mark an event from World War I due to his trip to Iraq.
The first Battle of the Marne lasted from 5-12 September and held off the German advance, opening four years of trench warfare in eastern France.
The second took place at the end of the war in July 1918.