Why do Mountain Bike helmets have visors?
One purpose of a visor is to shield the sun like a baseball cap.  

There are many factors: 


Wind resistance is not as big a factor on a mountain bike (slower speeds).  
The more upright position on a mountain bike puts a visor more into
play. 
On a road bike the rider is leaning forward and facing down and the visor can even block forward view.  
A visor can help keep rain, sprayed up mud, or low branches off the riders face.
Mountain bikers think it's cool?