How after a month of defeats and seeing his forces and principal ally being driven back relentlessly, did General Joffre reverse matters in the First Battle of the Marne? I believe the secret is that Joffre discovered his initial strategy and war plan had failed a week before his opponent, General Moltke, did. This allowed him to redeploy his existing forces and create two new armies to take advantage of the flaws in his enemy's thinking that he had detected in observing the apparently successful German sweep through Belgium and Northern France. Most important, Joffre's greatest strength, his skill at using railroads to move his troops, would prove to be decisive for the counteroffensive he envisioned. His new guidance to his commanders was delivered in a document called "General Instructions #2," issued on 25 August 1914.
Based Mainly on His Victory at the Marne Joffre Was Named Marshal of France in 1916
He summarized his thinking at the time in his post-action report on the Battle of the Marne:
The rapid retreat of the English, coinciding with the defeat sustained in Belgian Luxembourg (at the Sambre), allowed the enemy to cross the Meuse and to accelerate, by fortifying it, the action of his right.
The situation at this moment may be thus summed up: Either our frontier had to be defended on the spot under conditions which the British retreat rendered extremely perilous, or we had to execute a strategic retirement which, while delivering up to the enemy a part of the national soil, would permit us, on the other hand, to resume the offensive at our own time with a favorable disposition of troops, still intact, which we had at our command. The Commander-in-Chief determined on the second alternative.
Henceforward the French command devoted it efforts to preparing the offensive. To this end three conditions had to be fulfilled:
1. The retreat had to be carried out in order under a succession of counter-attacks which would keep the enemy busy.
2. The extreme point of this retreat must be fixed in such a way that the different armies should reach it simultaneously, ready at the moment of occupying it to resume the offensive all together.
3. Every circumstance permitting of a resumption of the offensive before this point should be reached must be utilized by the whole of our forces and the British forces.
. . .My plan of August 25, besides calling for a retreat to the lines of Verdun-La Fère, also called for the organization of an entirely new French army to the left and rear of the British army. This was named the Sixth Army, which was put under command of General Maunoury. It began assembling on August 27. It was made up of troops taken from our right in Lorraine, and its task was to prevent the outflanking of our forces by itself outflanking the enemy. Eventually, it would cover Paris.