In agreeing with the previous post, the machine gun played a vital role in developing the trench warfare approach and mentality. The idea that lines were established and there was a section of "no man's land" where neither side could tread unless risking being shot was because of the rapid fire nature of the machine gun. No other weapon would have been able to create this zone where crossing meant absolute death. Traditional rifles took too long to load and other weapons lacked the precise and efficient nature of the machine gun. The idea of also being hunkered down in a trench, waiting for the enemy to cross could only have been accomplished with a machine gun.
I wouldn't disagree with pohnpei's answer, although I would give equal credit to the heavy artillery of the war. While the machine gun made it very difficult to successfully attack a fortified position held by the enemy, long range artillery made it very difficult to stay above ground in your own lines. The artillery barrages that were typically unleashed before an infantry attack were so intense and severe that it had to drive military units underground just in order to survive.
As ugly as it was to live the majority of the time in a muddy, fetid trench, you would have been hard pressed to find a soldier on either side that really wanted to spend a lot of time above ground, eihter on the attack or in their own lines.
I would have to give credit for this to the machine gun. That is the main weapon that made trench warfare necessary in World War I.
The reason that this weapon was responsible for the trench warfare is that it made defense way too easy relative to offense (in war). Any army that attacked another could be easily mown down by machine gun fire (if they did it in the massed formations that were popular up until that time).
The machine gun made trench warfare necessary but it also was one of the factors that made it very bloody.