Vaccinated people act as a sort of 'firebrake' in the spread of the disease, slowing or preventing the further transmission of the disease to others. Since the protection offered by vaccines is rarely 100%, the vaccine will be more effective if more people have been vaccinated. This is because the disease may be able to jump from one vaccinated person to another person who has not been vaccinated, but is unlikely to be able to jump from one vaccinated person to another who has been vaccinated.
Virologists and Epidemiologists who have studies these areas have found that when a certain percentage of a population is vaccinated, the spread of the disease is effectively stopped. This critical percentage depends on the disease and the vaccine, but 90% is not uncommon. This is herd immunity - the fact that others in the herd or population have been vaccinated provides protection to all others, whether or not vaccinated themselves.
It is therefore the general aim of those involved in public health to establish herd immunity in the populations for which they are responsible. However, this is not always possible, or may fail after time. For example, see the controversy in the UK about the MMR vaccine.