Imagine you are driving down a highway and the driver in the vehicle ahead suddenly slams on their brakes. Your vehicle should be able to decelerate about as rapidly if you also slam on your brakes. However, when it comes to responding to a road hazard, it takes some time for you to detect the hazard, identify it, decide what to do, execute a response, and finally, for your vehicle to respond to your input.
Using the scenario above, with a following distance of 1 second, if you were to take longer than 1 second to react and slam on your brakes, you would probably collide with the vehicle ahead. However, if you were to use a 2-second following distance, you would have up to 2 seconds to see the brake lights in front of you, recognize that the vehicle ahead is slowing significantly, and apply your brakes. Giving yourself an extra second of following distance increases your chances of avoiding a collision.
The 2-second following rule is therefore based on the approximate time it takes drivers to respond to sudden braking ahead, plus a certain margin of safety.