A diplomat of the time compared Europe to "a powder keg," and it proved an apt description. Serbia had only recently gained independence from Austria-Hungary, and it had been far more costly than it need have been due to a broken promise. Russia had made an empty promise to back Serbian independence shortly after the Crimean war, and then broke that promise to avoid a war with Austria-Hungary. This time they would not back down.
In the aftermath of the assassination of Ferdinand, Austria-Hungary blamed the assassination on the Serbian government (even though the assassins were an NGO terrorist group), and made a series of demands that interfered with Serbian sovereignty. Serbia asked Russia for a promise to back them up, then refused to concede to Austro-Hungarian terms. When Austria-Hungary mobilized to invade Serbia, Russia mobilized to counter-invade. Germany had a military alliance with Austria-Hungary and warned the Russians to back off or face invasion; essentially giving Austria-Hungary a blank check. Austria invaded Serbia, and Germany invaded Russia to prevent Russia from backing Serbia. Unfortunately, Russia had a military alliance with France, so when Germany invaded Russia, France mobilized to invade Germany. Early success against Russia allowed Germany to quickly focus its efforts on the Western Front, but rather than meet the French head-on in the Rhineland, Germany went for an end-run through neutral Belgium. Violating Belgian neutrality drew Great Britain into the war on the side of Russia and France.
Throughout all this the Ottoman Empire (Turkey and the Middle East) wisely sought to stay neutral, but this was impossible. The Ottoman Empire held the Dardanelles and Bosporus straits separating the Black Sea from the Mediterranean. The Empire could either maintain its longstanding of keeping the straits closed to military traffic and that would benefit Germany and Austria-Hungary (the Central powers) by preventing the Russian Black Sea fleet from backing up the French Navy in the Mediterranean, forcing Britain to divert a portion of its Navy. If the Empire opened the straits to military traffic it would benefit France, Russia, and Britain (the Allies). Britain had recently confiscated 2 paid-for destroyers from the Ottomans for use in the war effort, so the Empire was already leaning towards the Central Powers. Fearing such a move, Britain sent two Cruisers and a minesweeper to destroy the defenses along the straits and keep them open. That act of aggression brought the Ottoman Empire in on the side of the Central Powers, and with that all of Europe was at war.