It's obvious that if you limit your partners to exactly zero, you are not going to be at risk for nearly all STIs. Just like if I don't cross the street, I'm not likely to be hit by a car. Some nonsexual behaviors can present risks of some (like using intravenous drugs), but over all, sexually transmitted infections are called that because they are most often transmitted through genital sex. So if you don't have any kind of sex (we're mostly talking about oral, anal, vaginal and penile sex), you're probably not going to get or transmit an STI.
But you already knew that. What you might not know is that delaying sexual activity -- or at least some of it -- is also known to help prevent infections. Just from a physiological standpoint alone, very young women, in particular, are more susceptible to STIs just because of the state of their not-yet-finished reproductive systems. Too, younger people often have a tougher time using and negotiating safer sex practices as well as acquiring regular sexual healthcare. So, sometimes even just putting off sex one more year can make a big difference when it comes to your health.
You probably also already know this, but if you and a partner have been each other's only partner for ANY kind of sex, and neither you nor your partner have ever been sexually assaulted, your risks of nearly all STIs are also very low. Oral herpes is still a big possibility since so many people have it and usually acquire it nonsexually in childhood, and for someone who, for instance, was born with HIV, that STI would still be an issue. We still strongly encourage even folks in that situation to start with other safer sex practices -- barriers and testing -- for the first six months, however. Not only do we have to face the reality that not everyone is truthful about their sexual history -- and very frequently, people are not -- but it's just a smart practice to get the hang of. You may need aspects of that experience later with that partner to negotiate and work birth control, for instance, or may need to know how to do safer sex right if one or both of you don't stay exclusive or together.
Even if you already are or have been sexually active, or you or your partner have had more than each other as a partner, it's still sound in terms of your health to be selective about sexual partners and make an effort to limit your number of partners. Why that can often help to prevent infections is just simple common sense. If I cross the street one time a day, I have less of a chance to get hit by a car than I do if I cross it twenty times a day. If I have heterosexual intercourse several times a month, I'm more likely to become pregnant than I would be if i had it but once.
None of this is to say there is one right or wrong thing for everyone when it comes to when we become sexually active or how many sexual partners we have, or that having a given number of sexual partners -- or none at all -- makes anyone a better or worse person. What's right for us emotionally, interpersonally, in terms of our life goals, experiences and relationships is something we have to figure out for ourselves, and something that varies a lot among people. But from a standpoint of personal and public health, delaying sexual activity (with partners: you can masturbate as much as you want) and limiting partners makes a difference and is a sound way of protecting yourself and others.