The mirror in a DSLR reflects light from the lens into the viewfinder pentaprism, allowing you to look through the viewfinder to frame a shot. At rest, the mirror sits at an angle in front of the shutter and sensor, blocking the light from hitting them.
When you click the shutter button, the mirror lifts up, allowing the light to hit the sensor to make the shot - this is why the viewfinder goes dark while a shot is being taken (for a fraction of a second in most cases).
The mirror is also permanently raised in Live View mode, because light has to constantly hit the sensor - hence, again, the viewfinder is black in Live View mode.
This image illustrates it pretty well: