How did militarism help to cause WWI?
I would define militarism as the glorification of the military. In a country that is militaristic, people think that the military is superior to civilians and that the military should be respected and glorified. This contributed to WWI by giving the military more control over the policies of various countries and by making those countries think that military power was what made them great.
During the time before WWI, many nations started to define their national greatness militarily. They thought that having a strong military made them great. This led, for example, Germany trying to build a much stronger navy to show its power. Germany's naval building programs scared and threatened England and so it tried to increase its navy. This arms race made the two countries more and more suspicious of each other and made war between them more likely.
If you don't like long answers, I can sum the other person's reply up for you.
It might not be completely accurate, or short enough for you, though.
Basically, militarism, a country's glorifying of its own military, can cause countries to become arrogant and power-hungry, as well as competitive for such power. In the years preceding WWI, many nations wanted to show off their military power.
An example is Austria-Hungary, who wanted to keep their reputation after realizing that if Slavs in the Balkans rebelled against the weakening Ottoman Empire for their freedom, they might do the same in Austro-Hungarian colonies. Therefore, Austria-Hungary went out and annexed two countries, Bosnia and Herzegovina. This enraged the Balkan Slavics, and the tensions came to a breaking point on June 28, 1914, when Black Hand member Gavrilo Princip (a Serbian nationalist) assassinated Archduke Franz Ferdinand and his wife Sophie.
Btw, reports state that Sophie jumped in front of the first bullet that was meant to kill the Archduke, and because she was pregnant, (some of) the Archduke's last words were reportedly "Sophie, Sophie! Don't die! Live for our children!".
^ This is the only part that I had to reference Wikipedia for. The rest is from what I learned in almost three years' worth of history.