Before autofocus became a standard photographic feature, there wasn't a great need for lenses and cameras to communicate with each other. The advent of autofocus and image stabilisation, however, together with the shift from analogue to digital capture, means that cameras and lenses are ever more reliant on electrical communication.
The introduction of autofocus necessitated a way for the camera to instruct the lens to drive, so that focus could be achieved. Subsequent improvements in lens technology also relied upon these contacts, such as for communicating distance information from the lens and subject to the camera (used to determine metering and flash exposure, for example), as well as for lens-based image stabilisation systems. It is also through these contacts that a camera can tell whether the lens has malfunctioned, and warn you by the appropriate error code.
Nowadays, lenses and cameras rely greatly on these contacts for communicating information to each other. The name of a particular lens and (with zoom lenses) its current focal length is not only stored as EXIF data by the camera, but also used for correcting certain aberrations such as barrel distortion. Likewise, if a lens is set to a particularly wide aperture, some newer cameras may act to remove vignetting from the peripheries of an image.
Adding more contacts allows a camera manufacturer to keep the same mount while essentially upgrading the lenses to a different specification, although the camera bodies will need to follow suit for the lens's contacts to have something to connect to. Recently, when Olympus and Panasonic launched the Micro Four Thirds system, they added two electrical contacts to the existing nine found on standard Four Thirds lenses. This was done for a number of reasons, notably to support movie functionality and any other future developments, though it also served to enhance the speed at which data could be transferred between the lens and camera.
It is important to take care of the contacts on both the body and lens, so they don't accumulate dirt or get damaged. If dirty, it's possible to clean these contacts using isopropyl alcohol and a soft brush, though care should be taken not to damage them.