From what I can tell both sides were forced to dig into the earth to protect themselves from the storm of steel above them. However, I read that leadership would rotate soldiers into the trenches to try to keep them fresh and keep morale up as much as they could. So if they could pull soldiers out of the trenches, and the trenches were just absolutely horrid conditions, why even keep them there in the first place? If the gunners were doing a good enough job keeping the enemy pinned down, why not have the others safely behind the guns in some bunker, away from the awful conditions, awaiting orders or a charge of some sort? Were their any necessary duties that they needed men to perform that forced soldiers to remain in the trenches?
You're absolutely thinking along the right lines. There was no good reason to keep the front line trench fully manned. The Germans quite quickly realised this, and in March-April 1915 began to man their front line very thinly. They built wohngraben, which I understand were basically deep dugouts for the soldiers to live in, in the second or third lines of defence. I would hesitate to say that the conditions in the trenches were the most important factor, because in a lot of cases the trenches were actually very well-built and the men made themselves at home. The real value of the German method was to reduce the effect of enemy bombardments. At Neuve Chapelle on 10 March 1915 the British had launched a very concentrated bombardment on the single German trench and virtually levelled it, along with a large number of the defenders, and captured about 2km of ground. The German response was firstly to greatly toughen their defences, but also to build extra trench lines to make their defence deeper. If an enemy bombardment started the few men in the front line would evacuate, and the troops would shelter in their dugouts, which were deep enough to be virtually invulnerable to even the heaviest guns. When the enemy attacked, they could emerge and usually man the front line in time to repel the attack; failing that, they could defend the second line. By holding the front trench very lightly the Germans took very few casualties from artillery. At first there was a tendency to try and hold a rigid line but as the war went on the Germans were more willing to give up ground and defend in depth. The British, who didn't actually get attacked on the western front between April 1915 and March 1918, tended to hold their front line far too strongly, which meant that when attacked they took high casualties and their defences were inflexible and easily ruptured. This is a major reason why the Germans advanced as far as 40 miles in 1918.
All that applies to defending against major offensives. In routine trench-holding (i.e. most of the front for the majority of the time) the front line could never go entirely unmanned. It was the first and most important line of defence, and there was a certain amount of constant maintenance work which had to be done to keep the trenches in a defensible and livable condition, such as shoring up the revetments, digging latrines, keeping the trench clean, unobstructed and as hygienic as possible, cleaning weapons, cooking (or carrying up hot food from the rear), carrying up other supplies and generally making the place comfortable. There was always the risk of an attack so the trenches could not be allowed to fall into disrepair, and there had to be lookouts ready to sound the alarm in the event of a raid. It was also necessary to try and hinder the enemy as much as possible, which involved observation, sniping and raiding; the latter in particular required well-maintained positions as close to the enemy as possible. The British especially put a lot of stock into raiding as a way to pressurise the enemy and maintain aggressive spirit among the troops, in addition to the obvious benefit of killing enemy troops and capturing prisoners or documents, vital sources of intelligence.
The key thing is that if the front line was unmanned, there was nothing to stop the enemy entering it, and that could obviously cause a major weakness in the defences. There always had to be at least a thin presence in the front line, although as you have quite correctly identified, there was no reason to keep all the men there all the time, and most stayed in the second or third lines and rotated into the front line a few at a time. That was when they were in the trenches at all, but in fact, for British troops at least, it was unusual to spend more than four or five days out of a month in the trenches--if involved in a major offensive, troops would be relieved within a day or two of going into action. Troops spent much of their time labouring, training, or resting behind the lines. Other armies were less generous--the French, until 1916, left units in the trenches until they were exhausted before withdrawing them, and even then rotation was less frequent--but no army left more men in the dangerous front line than was necessary.
Here is a good article that discusses the daily routine of the troops.
It's 2.30am so I'm sure this isn't the best answer I've ever written! Let me know if there's anything I've neglected to explain.
Sources:
Griffith, Paddy, Battle Tactics of the Western Front.
Ashworth, Tony, Trench Warfare: The Live and Let Live System.
Prior, Robin and Trevor Wilson, Command on the Western Front.
Samuels, Martin, Command or Control?: Command, Training and Tactics in the British and German Armies, 1888- 1918.
Corrigan, Gordon, Mud, Blood and Poppycock.