I don't usually wash yarn before using it.
As long as the yarn is washed and let to fully dry while in a hank (moldy or rotten yarn is no fun at all!), I see no reason that washing would cause harm. Just be sure you follow washing directions for the fibers in the yarn and that the yarn is fully super dry before you ball it up again.
I will say that I don't wash yarn before I knit it, but I also take my knitting everywhere with me and make sure I wash the FO as soon as it's done.
There are some actual benefits though, like with hand-dyed yarns that might bleed (this becomes a necessity if you're working on a project with multiple colours) or yarns that are very 'sheepy' or 'rustic' and washing them will soften the yarn and let it bloom a bit.
I tend to avoid this unless absolutely necessary though, since I work only with natural fibers and they'd have to air-dry, and it's humid here and that can take a long time.
There aren't really any cons to pre-washing your yarn though, other than not being able to cast on with the yarn as soon as you buy it though.
Here is a video on washing yarn. This is from a spinner, so the yarn she's washing is stuff she's spun and dyed. If you want an excuse to wash your yarn, get into dying. Or get into recycling yarn from sweaters; I do that, and I wash the yarn after I unravel it.