Avoid punishing your child for swearing at this age. The words don't have the meaning they do for the adults, and when toddlers use them, they're simply testing out how words work—what response they get from the people around them.
Older siblings, however, can certainly have a consequence for inappropriate language. Create a positive model in your family for how you treat each other and the language you want your toddler to learn, and they will continue to soak this in as they grow up.
As a toddler, your child cannot understand the meaning of a swear, but when they get older (during their pre-K and school age years) there will be more lessons on language to teach. Here's a great book about understanding hurting words and using kind words with each other for older kids: Words Are Not for Hurting
Other like-minded books for the preschool shelf:
This information is intended to be a conversation starting point and not to replace consultation with a mental health professional. Knowing your child the way you do, adjust or edit this script and these recommendations to meet his or her needs and comprehension. If you have concerns about your toddler, contact your pediatrician and request a referral for a mental health professional who specializes in work with young children. Click here to find help for working with your child through this and other touchy topics.