He was the heir to the Austro-Hungarian throne and when Austria-Hungry tried to get Serbia to go by their demands the Serbians refused and because of that they declared war but also since Austria-Hungry was friends with Germany Germany joined on the side of the Austro-Hungarians and France was allied with Russia and because of this shortly after Germany declared war on Russia they declared war on France too. Hope that was helpful!