Trains are long chain of compartments with wheels and the engine lies in the first and last compartment. When a train moving with some velocity undergoes sudden deceleration that is comes to a stop, brakes are applied only to that compartments where the engine is. Other compartment are still in motion due to inertia of the train. In absence of buffers, these compartments would collide with the engine compartment and thus create damage. Buffers act like springs. Hence the force imparted by the passenger compartments is distributed quite effectively by the spring as time taken for the impulse would be more hence the net force on the engine compartment would be less and there wouldn't be any appreciable damage.
Buffers increase the time of impact between the two bogies before they stop and hence jerk is reduced.