Answer: Because Germany was located in between potential enemies to its west (Britain, France) and a major potential enemy also in the east (Russia).
Context/detail:
Let's assume your question is referencing "The Great War," which we now know as World War I. There was much military buildup and an arms race between the nations of Europe and increased tensions between the nations of Europe during the early years of the 20th century. Along with increasing expenditures on military forces and navies, there was pressure to form alliances with other nations to strengthen a nation's defenses in case there was a war. The Triple Entente and the Triple Alliance set up in opposition to each other.
The Triple Entente aligned Britain, France and Russia all as allies with one another, sworn to come to each other's defense in time of war. That put Germany and its allies (Austria-Hungary and Italy*) in between those powers. Germany knew that if a major war broke out, it would need to fight on both its western and eastern front.
Because Russia and France were tied together in an alliance, and opposed to Germany, the Schlieffen Plan (developed by German field marshall Alfred von Schlieffen) determined that a quick strike against France on the western front would be necessary in order to focus any war efforts against Russia in the east. This played into the start of World War I, because when only Germany (along with Austria-Hungary) and Russia were involved in war declarations after the assassination of Austria's archduke Franz Ferdinand, the first thing the German army did was to go and attack France.
*<em>Note: Italy changed sides when the Great War began and sided with the Allies (Britain, France, Russia, etc) rather than the Central Powers (Germany, Austria-Hungary, plus Bulgaria and the Ottoman Empire).</em>