Anal incontinence can be treated in several ways depending on the causes and exam findings.
Diet changes – Anal incontinence in women who experience diarrhea or loose bowel movements will often improve with avoiding spicy foods or stimulants such as caffeine. Alternatively, fiber supplementation (with whole grains, fruits, vegetables, or high fiber cereals) or over the counter fiber supplements can sometimes help make stools more formed, resulting in more complete passage during bowel movements.
Medications -- Sometimes medications such as loperamide can be used to treat or prevent diarrhea, decreasing the frequency or looseness of bowel movements.
Biofeedback – Specialized physical therapists can often perform biofeedback to improve sensation and muscle strength. See your doctor for a referral.
Surgery – Damaged anal sphincter muscles can sometimes be repaired with surgery, more successfully when the nerves are working properly. Repair of rectoceles or other forms of prolapse can lead to improved bowel emptying. Fistula repair is generally curative when there are no other factors contributing to the anal incontinence.
If these simple measures don't work, then you should talk to your primary care physician. If you can't solve these problems together, then a specialist such as a urogynecologist or gastroenterologist should be consulted.