A breast infection is, well, an infection in your breast. Like other infections, it comes from bacteria (usually the same bacteria that tends to hang around on your nipples or in baby’s mouth). The bacteria may get in through an untreated crack in your nipple, or an infection can occur when a plugged duct isn't treated right away. It's more likely to happen when your breast isn't being drained well (by baby or by breast pump).
To prevent a breast infection, take action to prevent plugged ducts, engorgement, and nipple cracks. Make sure your breasts are emptied frequently, pump if you are away from baby at feeding time, manage your stress levels, get enough rest, wear bras and clothing that don't put pressure on your milk ducts, change wet breast pads ASAP, and make sure baby's latch isn't damaging your nipples. (A lactation consultant can help.)
If you get a plugged duct, treat it right away. Same goes for nipple cracks. (You may need to adjust baby's latch to prevent further nipple damage.) If you have flu-like symptoms along with a tender — often reddened — area on one or both breasts, see your doctor ASAP. This could signal an infection. If you do get a breast infection, dealing with it promptly (usually with an antibiotic) can help protect your milk supply and prevent the formation of a breast abscess.