Militarism is a political idea that focuses on building a military. It is built around the idea that nations need to have strong militaries if they are to protect the interests of their people. If those interests create a conflict with the interests of another nation, the military is there to solve that through things like wars. Militarism is usually about territorial expansion.
It influenced them because the nations needed colonies in order to stay relevant on the worldwide market and be powerful. Britain and France had numerous colonies while Germany wanted to get some of them and Austria-Hungary and Ottomans had problems with people wanting to become independent. This resulted in all of them heavily focusing on their militaries which eventually brought world war 1.