What happened is that Bismarck was hell bent in Unifying Germany in hurry at all cost. He reasoned that a war with France will help him achieve his goals. A totally Machiavellian approach “The End Justified The Means”. France obliged knowing that the French military was not ready for a major war against Prussia and her allies. That was one of the stupid moves in a history we call, great blunders of history.
A few things lead to Franco Prussian War:
1) Bismarck’s raw ambition and his Machiavellian mindset was such that he wanted to unify Germany by all means necessary. Bismarck reasoned that a war against France will rally all the German states to stand behind Prussia as Germans against a common enemy France. His strategy hinged on engineering or forcing a war against France. So from Bismarck vantage point the war was inevitable, it was just a matter of finding a pretext to trigger the war.
4) Meanwhile, Napoleon III needed a victory after the recent setbacks in Mexico which ended in 1867. Napoleon III although not immediately he was seeking a war of redemption. The Franco-Prussian war assuming that it had went France’s would have been the war of redemption. However, France military state was such that was in no condition to take Prussia immediately. So from France perspective the war needed delayed but in long term it would also have been inevitabl.
Now Bismark was looking for a pretext, it present itself in 1869.
1) The Spanish parliament offered the throne of Spain to Prince Leopold of Hohenzollern-Sigmaringen, nephew of King Wilhelm I of Prussia. While and King Wilhelm, on the insistence of Gramont to renounce the offer did turn down the offer afraid of risking war, Gramont managed to offend the Prince and King of Prussia by demanding that King Wilhelm sign and publish a document renouncing all future claims to the Spanish throne.
2) Meanwhile Bismarck was attempting to accelerate the unification of Germany through a war. This event gave Bismarck the opportunity he looking for conive a war. Indeed Bismarck engineered a way for the French to declare the war on Prussia to canning and manipulation. He reworked a telegram to make it appear the King Wilhelm had rebuffed the French ambassador ( Count Benedetti), and the ambassador had insulted the king . Bismarck’s released statement to the press that became known as Ems Dispatch.
All this combined triggered the Franco-Prussian war, albeit prematurely for France.