The (simplified) theory is that elevated levels of insulin cause pimples to form. Insulin is a hormone that is released in response to eating, and tells your cells to take in sugar from the blood (glucose) and store it for later use. Insulin has a tremendous number of other, down-steam effects on the body, many of which are not well understood. One of the effects of higher-than-normal levels of insulin is an increase in insulin-like growth factor-1, which shifts the body's endocrine balance and promotes acne (check here
for a paper on this in the Journal of Comparative Biochemistry and Physiology). Insulin is commonly associated with diabetes, where the body becomes desensitized to the hormone and progressively more and more is required to keep blood-sugar levels in check.
Insulin levels and blood-sugar levels are closely related (diabetics measure their blood-sugar levels to determine if they need to inject insulin), and blood-sugar levels are controlled directly by what you eat. Sugary and starchy foods, like table sugar, potatoes, and bread, can raise blood-sugar levels quickly for relatively small portions. Fruits and vegetables act to raise blood-sugar levels more slowly and to a lesser degree because they contain different types of sugars (typically fructose instead of sucrose) and lower quantities of sugar for the same portion size. Meats, fats, and other non-carbohydrate containing foods have little influence on blood-sugar levels.
So, preventing acne is a matter of eating right to keep your insulin levels low.
Take note that there is a fundamental difference in this approach compared to other acne-remedies. Keeping insulin levels low addresses the root cause of acne while most other techniques (salicylic acid to remove dead skin cells more readily, antibiotics to kill the infecting bacteria, or birth-control pills to regulate hormonal levels) treat only the symptoms.