Primarily because the horses were used for supply and communication, in the rear areas, not for frontline combat. The men of the Heer's infantry divisions did not ride horses or horse carts - they marched by foot. Their baggage, their supply, their ammunition, their artillery and heavy weapons were carried by horse and drawn behind horse carts.
There are plenty of pictures showing German horses and horse carts doing these tasks. Here are a few examples:
German horse-drawn supply column.
The horses were transport for supplies and equipment, and had little business in the front lines. Their main equivalent in motorised forces were unarmoured trucks, which also had little business in the front lines. Unlike horses, trucks in motorised units would carry soldiers. Soldiers in unmotorised/unmechanised units got to walk, unless rail transport was available. Thus, horses don't appear very often in photos of soldiers in front line areas.
In rear area photos, there are often horses aplenty, especially when units are on the move:
The unmotorised infantry sometimes get to ride the rails:
but otherwise get to walk:
There are biases in the photos that we see. Logistics is one of the unglamorous parts of the military, and is photographed less often than the combat parts. If you look at photos of motorised forces of WWII, trucks do not appear in photos as often as one might expect from their numbers. Where they are seen, they are usually in rear areas:
British transport: http://www.ww2incolor.com/britain/aHighland_001.html
US transport: http://www.ww2incolor.com/us-armor/aCider.html
US transport: http://www.ww2incolor.com/us-armor/aOperations_.html
A German truck that has gone as close to the front as it is going - time for the infantry to get out and walk: http://www.ww2incolor.com/german/tankbusters.html
Horses will operate in the area of the front:
For example, anti-tank guns are often pulled by horses, and are often placed in the front lines:
https://www.reddit.com/r/wwiipics/comments/j0jtww/a_german_antitank_gun_pak_3536_caliber_37_mm/
Soviet: http://www.ww2incolor.com/soviet-union/Ulloi_v_budapeshte_1945.html
but the horses will be kept out of harm's way if possible. If the horses have been moved to the rear area, or not enough are available, human-power will be used to move guns:
Heavier artillery will usually be significantly further back, exposing horses and motorised transport to less danger (but they can still be hit by counter-battery fire). Horses and motorised transport of artillery:
Soviet: http://www.ww2incolor.com/soviet-union/aArtillery+1945_budapest_zenitka_37_mm.html
US: http://www.ww2incolor.com/us-armor/aM4-HST-tows-155mm-Long-Tom.html
Horses do get hit behind while in the combat zone, even if behind the front line, by artillery and air attack. This horse and driver were killed while moving cooked meals to the front line:
Horses would also be used at the front by cavalry:
although the front for cavalry units (such as this one) was often the rear, with their main activities being in principle fighting partisans and in practice killing unarmed civilians. Officers would sometimes ride horses:
Other animals were also used for transport: