For centuries, bloodletting was a common procedure used to treat a number of physical problems, ranging from sore throats to strokes. Physicians in the Middle Ages delegated bloodletting to barbers, who had experience with sharp instruments. So in addition to cutting hair (and removing lice), these barber-surgeons also pulled teeth, set broken bones and dressed wounds.
The traditional red and white of the barber pole represented their bloodletting expertise -- the red of the blood and the white of the bandages. In America, blue was added, but the reason is unclear. It could have symbolized the veins cut during bloodletting, or it could have just been a nod to U.S. patriotism.
More on bloodletting: