The answer to your question is as stated by Cascoly. Since the dawn of time warfare has existed, but also the need/desire to pin your enemy in a certain location or point which is beneficial to your strategy. Overall it is easier to merely beseige an enemy rather than attack him and face loss.
In terms of the First World War, it is possible that the Trenches were originally intended to be a stop gap, merely a short time to reorganise etc. Whereas, the armies became settled in their 'trench systems' and this ultimately led to the famosu images we now have of that terrible war.