It's virtually impossible to contract a virus outdoors in the open air anyway, unless there are tonnes of people in a relatively confined space, and even then you are far more likely to contract it indoors. You don't need to wear a mask in that situation.
They lessen the amount of virus which is expelled. Studies show that the amount of exposure you have to the virus is directly related to how severe your case could be. As an exercise of thinking. Imagine you are s**t. If it was just a little(it's easy to find little concentrations on food we buy) you could have an infection, mas most probably than not, nothing serious. But if you ate a bowl of that, what do you think would happen to you? Just using an extreme exemple just so you understand the importance of lessening the concentration of the virus in the air.