Front and rear bumpers are designed to be both aerodynamic and to absorb some of the sudden forces in a collision.
Early bumpers were an additional piece of metal added to the front of the car, sometimes with rubber supports. Many modern bumpers are hidden just beneath the vehicle's body, and are made of layers of foam and collapsable metal. They are designed with safety in mind, and sometimes even enhance the structural rigidity of the vehicle. The extra layer(s) a bumper provides keeps the driver and passengers from feeling the entire force of a crash at one small point in time, and that spreading of the forces may mean the difference between life and death in many instances.
Some governments of the world regulate how high bumpers must be, which sometimes limits car designs (such is the case with very small cars in the United States). Having bumpers at generally the same height is good for safety, but only by a small amount (assuming that size and type of car wouldn't have been designed that way anyway).
Racing vehicles have various types of bumpers, for safety and other advantages, such as brush guards in rally events.