Against small-caliber firearms, no problem. Your Earth mages just interpose earth or rock as "movable walls", providing quite adequate cover. This will even work fine against massed machineguns, as their penetration ability is quite minor and even just a 2-foot earth wall will absorb. Air and water mages can summon fog to hide themselves. Lightning mages could counter attack, just imagine how electrified the enemy become when you zap their barbed wire barricades, and the metal of their rifles. Typical WW1 firearm engagement ranges were tens of meters only, well in range of your Mages.
Against large-caliber direct-fire weapons, like cannons, you can do the same thing but with a lot more effort. To stop a 155mm HE round from a cannon will just turn a 2-foot earthen wall, or even a 10-foot thick wall, into a destructive blast. So the Mages could only defend by hiding underground, in deep trenches, or by not being where the enemy is targeting (via stealth, misdirection, false images, etc.) In other words, the Mages are not much better off than mundane soldiers on the battlefield, they can just dig their trenches much faster. Cannon and mortars would engage at ranges of hundreds of meters, well outside the range of your mages. They could not counterattack, just defend.
But the killer: Indirect-fire, long-range artillery bombardment.
The only way to protect themselves would be to burrow deep under ground, or cower in trenches and hope the artillery does not land in the trench. Exactly the same as the poor normal soldiers. Illusions or fog will not hide them, because the artillery is not firing at a target but at a location on the map. Air will not protect them, because there is no ways to detect, target and divert an artillery shell approaching at more than the speed of sound. Artillery engages at ranges of kilometers to tens of kilometer. Your mages will not be able to engage, indeed they will not even have a means to detect just who/where is shooting at them. They can just defend, and either withdraw or hunker down and hope the enemy runs out of ammo.
At least, with both Earth and Air mages, you can tunnel all over the place like rabbits. This will make escape much easier, and there is the potential to tunnel towards the enemy and bypass their frontline defenses. This, combined with their excellent defense ability against small-arms may be very valuable in a battle.