That's a very interesting question, and relates a lot to a common perception that, once a certain level of authority is reached, the individual is less likely to participate in combat.
That is a very generalised view, of course, and as such not entirely correct. An army is a very rigid organization and must be tightly controlled and led. The closer that leadership is to the fighting, the more effective it can be. The balance, of course is to not expose high ranking leadership to the dangers of the front unnecessarily. Also, the larger formation one commands would dictate having to be further removed from the front on the basis of the scale of numbers a Division, Corps or Army commander would be dealing with.
There also lies a difference in the role of particular persons-what is known as "the Divisional Wedge"- which describes the ratio of those engaged in combat to those supporting combat operations. A Lt Col as a battalion commander would very likely advance with his men, while a Lieutenant assigned to General Headquarters might not ever hear a shot fired in anger. Likewise for NCO's. A farrier Corporal would be well removed from fighting, performing his job of shoeing horses, whilst a Sergeant in an infantry platoon would certainly see his fair share of the war.
Maj Gordon Corrigan illustrates that even high rank did not exempt one from the dangers of the war: "Altogether four British lieutenant generals, twelve major generals and eighty-one brigadier generals died or were killed between 1914-1918. A further 146 were wounded or taken prisoner. Whatever else the generals were doing, they were certainly not sitting in comfortable chateaux." Mud, Blood and Poppycock Cassell Press, 2003.
I don’t think there is a simple answer for this question.
Certainly battalion commanders would be expected to participate in an attack, while a Lt. General would almost certainly be at Corps rather than participating in the fighting. Between the two – brigade and divisional command – the activity of the commanding officer would vary according to the local situation and the practice of the officer himself.
But it wasn’t unknown for higher ranking officers to be killed in action. Even being a Field Marshall was no guarantee of safety – Field Marshall Lord Kitchener was killed when his ship struck a mine and Field Marshall Lord Roberts of Khandahar VC died of pneumonia he contracted this when visiting Indian troops. He refused a great coat, insisting he should not be more comfortable than the troops he was inspecting (As an aside, Roberts career was quite amazing as it encompassed the Duke of Wellington, through to aeroplanes, chemical warfare, and armoured cars).
Some 78 British Generals were killed in action during the war (See Bloody Red Tabs by Davies). The breakdown is given as roughly 40% to shellfire, 30% to small arms fire (half of whom at least half were to snipers) with the rest down to accidents, drowning, or not determined.
The stats are interesting as overall casualties tended to be much more heavily weighted towards artillery (usual figure given as c60% to artillery), whereas Generals seemed to suffer far more small arms fire and particularly sniper fire. This may just be a statistical artefact due to the low sample size, but it’s likely that Generals visiting the front were prime targets for snipers who could identify them by their clothing and other accoutrements.
On the other hand, you could be a plain old Lieutenant at GHQ in mid 1915 and never see the front. Staff officers were strongly discouraged from visiting the front as the casualties they incurred early in the war were unsustainable and qualified staff officers were a rare commodity indeed (See Gary Sheffield – Command & Control on the Western Front).
Overall, you were probably better off as a private soldier than an officer.
As an addendum to my answers below, and a helpful guide to remembering what unit is larger than the other in organisational tables is this mnemonic:
"Such Pleasant Company Being Right Beside Dedicated Comrades Always"
for
"Section Platoon Company Battalion Regiment Brigade Division Corps Army"
For a more detailed treatise on organisational structure, including approximate numbers in a particular formation please see my essay posted here
edit:formatting