Right after take-off (which means an airplane already exceeded V1) it is recommended that an airplane keeps climbing even when emergency occurs. Beside worries of crashing into houses and buildings by flying low altitude, why should an airplane not stop climbing up? Why should it climb up and then, lowers to some altitude and then land?
In the days of my youth I in was in the air cadets and we used to fly in Chipmunk training airplanes. I remember being told you should never attempt to turn shortly after takeoff because you weren't at full speed and turning risks stalling the inside wingtip. If you do that the result is a spin and probably a crash.
The rules were that if a problem arose immediately after takeoff you landed in a straight line and hoped the runway was long enough. At higher altitude you attempted to reach cruising speed then you turned. I asked the instructor what happened in between, and he told me that if he survived I'd be in trouble :-).
A quick Google found this article (amongst many others). Look for section "Cross-Control Stalls". It basically agrees with what I've posted above though I've made it sound a bit too simple.
After take-off, the aircraft is heading away from the runway. To return to the runway the aircraft must turn 180 degrees and realign itself with the runway. Turning loses altitude. Turning sharply loses altitude fast. Hence the need for altitude.
Aircraft turn by banking (primarily, flat turns using the rudder only are inefficient)
Banking makes the vector of the aerodynamic lift non-vertical, so lift is lost and hence altitude lost.
Even though the aircraft is powered, at take off near maximum power is being used and the aircraft is at its heaviest (fuel tanks full). This means it may be impossible to make a turn without losing altitude.
All in all, you need a minimum altitude before you can turn and reach the runway.
Good answers. Just to add what I learned in pilot training. You can never have too much Altitude, Avgas, or Asphalt.
There's safety in altitude. If you have enough altitude, you have glide range, you can turn, you have choices. When you take off, you want to get altitude quickly.
John mentioned what do do it you lose power on takeoff. The first thing is push the nose down from climb to glide. That takes about 4 seconds because you're surprised. The second thing is decide where to come down - is there sufficient runway left, or is there a smooth spot fairly straight ahead, or within 90 degrees left or right? If you have to head for trees, can you go between them and rub off the gas tanks? A good pilot has this all thought out beforehand.
Red talked about the turn-back. It's called the "impossible turn". In a small plane like a C172, you need at least 800 feet of altitude to do it, and takes practice. You have to turn more than 180 degrees and then you have to turn back. That last turn, to line up with the runway, at low altitude with trees around, is especially dicey. On top of that, when you land, the wind is behind you. Not fun. Here's a video about it.