Using condoms during sex is called the "barrier method" of protection. When used correctly, they're 98% effective at preventing pregnancy (but when used incorrectly, they're only 82% effective). Condoms can also be a good way to reduce your risk of contracting or spreading STIs. They don't protect you against all STIs (some can be spread from skin-to-skin contact, for instance), but it's a good place to start.
Worth noting: The best thing you can do for yourself in terms of protection against STIs: Get tested, know your status, and get treatment for any STIs that you do have. Not all are curable, but all can be treated to one degree or another. See more information about STI testing and treatment here.
Infographic via Erika Moen of OhJoySexToy.