A person can lie down on a bed of nails unharmed because the pressure of the body are distributed and not concentrated on a single point (which would definitely cause harm).
Further explanation follows:
Pressure is the ratio between force and area -- amount of force applied per unit area (F/A). If you tip-toe on a nail, the force you exert is concentrated on a very small area (tip of the nail). This results to a very large pressure which eventually will puncture your skin causing the nail to harm you. However, when you lie down a bed of nails, the force you exert (which is the same, since this is basically your weight) is now distributed over a lot of nails, and hence a much larger area. This reduces pressure by increasing the area, given the same amount of force. Hence, it is less painful, and sometimes, no harm is done.