A simple yes or no answer doesn't work for this question. Here's why: human breastmilk alone does NOT cause cavities. BUT, ad lib breastfeeding after your baby is 1 year old is associated with a higher risk of your baby getting cavities.
As soon as anything other than human breastmilk is introduced in your baby's diet (including baby food), frequent exposure to human breastmilk (ad lib nursing) can accelerate the formation of cavities on your baby's teeth.
Now, breastfeeding has been shown to have MANY protective and positive effects for both mothers and babies. We do not support a specific timeline for recommending weaning - that's between you and your baby. But we do want you to be aware of risks with prolonged ad lib breastfeeding and several ways to mitigate those risks:
(1) after each feeding, we recommend you wipe your child's teeth with a wet washcloth.
(2) as soon as your child has teeth it is crucial to make sure you're brushing them
(3) establishing a "dental home" with a pediatric dentist who can advise you on best practices