If the speed of light is constant, why can't it escape a black hole?

The speed $c$ that is constant is so when measured locally relative to a freefalling frame (i.e. one for which all points follow spacefime geodesics wrt to the metric $g$). Local means that the frame's extent must be "small" enough that it can be thought of as flat: think of this as zooming in on the spacetime manifold, which is a smooth object, with enough magnification that you can't see any appreciable deviation from Minkowski spacetime (which is the spacetime analogue of flat Euclidean space, which you've probably encountered). In contrast, the speed of light as measured by a distant observer can vary in generally curved spacetime.

The wording of your question suggests that you imagine sitting at some point within the horizon, and since your laser pointer's output must squirt out at the everconstant $c$, and the horizon is only a finite distace above you, it must reach the horizon and leave.

But the geometry is not like this everyday thought picture. The point about an event horizon is that it is not in the future of any event inside the horizon. The spacetime distortion from flatness is so severe that even the future branch of lightlike geodesics will not intersect it. You can only reach the horizon from an event within it by travelling backwards in time.

Some Q and A from Comments

User PeterA.Schneider asks:

"the speed of light as measured by a distant observer can vary in generally curved spacetime": That's the first time I have heard that. You sure? (Considering that essentially all of space time is curved.)

which question User Jan Dvorak eloquently answers:

don't worry, it will regain the speed of c once it gets close enough to you - if it does. Its wavelength when it meets you might differ drastically from its wavelength when it left its source, however.

and I'd like to explain Jan's answer a bit more fully. You infer something's speed by comparing the changes in your spatial and temporal co-ordinates for that object. Let's begin in special relativity, where at first both observers chart the Universe by Minkowski co-ordinates. The fact that your clock and rulers measure the same intervals differently from what the distant one does doesn't lead to any surprises (at least to someone who has studied SR thoroughly) because there is a unique, well defined transformation that will map your co-ordinates for events to the distant observer's co-ordinates, and contrariwise. That transformation is the (proper, orthochronous) Lorentz transformation, which has the property that $c$ is measured to be the same from both observers' standpoints.

In general curved spacetime it is impossible to define a unique transformation between two local frames that would allow us to directly compare measured speeds of things in this way. Let's look at why this is so.

Let's re-imagine our scenario above: we're still in Minkowski spacetime with the same physics and doing SR, but with new co-ordinates. At every point in that spacetime, we rotate and boost the "reference" frames a bit so that nearby points have their reference directions and time intervals slightly different. This is altogether analogous to charting Euclidean 3-space by, say, spherical co-ordinates. Locally, the reference directions (of increasing $r$, $\theta$ and $\phi$) are rotated from the Cartesian ones, and that rotation varies smoothly with position. Now there's a very big infinity of ways to do such a gauge transformation: we can choose directions and unit time intervals any way we like as long as the variation is smooth and that the limiting transformations as the distance between the points shrinks is a Lorentz transformation.

So now, in these new co-ordinates, how do we compare measured speeds if we were given only these co-ordinates? Well we could simply move through space and time along a chosen smooth path, making the little Lorentz transformations between neighboring reference frames and multiplying them all together to get an overall transformation for this path. But we could choose an infinity of smooth paths to do this along. So, if we're given only these co-ordinates, it's not immediately obvious that we wouldn't get a different answer from this procedure if we took a different smooth path between the two points.

But we do, because that's what flat means, by definition.

We can always make a transformation of our weird co-ordinates back to Minkowski spacetime if and only if the result of our calculation does not depend on path. The result of so-called parallel transport of a vector around a loop is always the identity transformation. A corollary of this fact is there is a well defined transformation between the two observers that allows us to compare measured speeds: it doesn't matter whether we compute it along path A or path B between two points: the answer must be the same since the inverse of one transformation must invert the other to achieve the identity transformation around the loop. Thus, in theory, we can still compute what the other observer would observe locally from afar in our weird co-ordinates.

If you've made it through this explanation this far, then General Relativity is now only a small conceptual step away. In curved spacetime, the transformation wrought on vectors by the parallel transport around a loop is in general not the identity transformation. So there is no well defined way of comparing speeds from afar, at least from one's own co-ordinate frame.

That's what "curved" means, by definition: nontrivial "holonomy" in parallel transport around closed paths

And this is what people mean when they say the "co-ordinate speed of light can by anything in GR". But if a distant observer measures the speed of light continually, repeatedly and at regular time intervals as measured bu their clock in a laboratory they carry with them, and then send the result to you, all their reports to you will be that their measurement hasn't changed, even though the interval between reports that are set regularly by their clock may reach us at wildly varying intervals by our clock.

Another analogy that might help you is the $2$-sphere, what we call a "ball" in everyday language, compared with the plane. On the plane, tangent planes to the plane are everywhere the same vector space: there is an unambiguous way to parallel transport the tangent plane at any point to that at any other point. On the ball, not so. Tangent planes at different points are not the same plane. They are isomorphic as vector spaces, but they are not the same. In particular, there is no well defined universal way of comparing them, or of assigning reference bases at all the points in any patch of finite extent, because, on the sphere, parallel transport of vectors around loops always leads to a change to the vector when it arrives back at the beginning point. Indeed, a sphere has constant curvature, which means that the rotation of the vector wrought by loop parallel transport is proportional to the area enclosed by the loop.

Suppose you are floating in a river, and you have with you a model boat, called the SS Lightray, that can do 3 m/sec through the water. When you set the boat travelling upstream as far as you're concerned it is doing 3 m/sec. But I'm standing on the bank watching the river flowing at 1 m/sec, so when I look at your boat I see it travelling at a net speed of 2 m/sec not 3 m/sec.

Now the river narrows and speeds up to 4 m/sec. As far as you're concerned you're sitting motionless in the water and when you send the boat out upstream again it is still travelling at 3 m/sec. However from the river bank I see the boat is now travelling downstream i.e. its speed upstream is -1 m/sec. The boat can't travel fast enough to make headway against the flow of the river.

Rather surprisingly an argument very like this applies to motion of light away from a black hole. It's called the River Model, and here is a link to a scientific paper giving the details. More formally this technique is an analysis of the motion of the light using the Gullstrand–Painlevé coordinates. I used this technique to explain why light can't escape from a black hole in my answer to Why is a black hole black?.

The local speed of light is always $c$, but if you use the Gullstrand–Painlevé coordinates to analyse what happens at the event horizon you find that:

  1. at the horizon you are falling inwards at the speed of light

  2. relative to you the light is travelling outwards at the speed of light

  3. so the net speed of the light away from the event horizon is zero

And that's why the light can't escape from the black hole.

To explain it in layman's terms, without using advanced concepts:

Space is warped in the "inside" of the black hole (that is, under the event horizon) so much, that it behaves completely different than what we perceive hear on Earth. The "outward direction" simply does not exist.

For example, here on Earth, we can go in the three spacial dimensions in both directions, but in time we can move only forward. Imagine that on the "surface" of the black hole, aka at the event horizon, the spatial dimensions have only one direction: inward. This last paragraph is not intended as an accurate description of how black holes work. It's only to conceptualize how there are cases where only one direction of a coordinate exists.