Its main purpose is to protect the driver element and speaker internals (and possibly other audio components) from foreign objects while still allowing the sound to pass clearly.
In general, soft grilles impose little resistance on the speaker driver because the material is free to move synchronously with the sound waves.
Soft grilles offer protection from small, lightweight objects, and may be water resistant to some degree but could be susceptible to being torn, or even stretched enough to reach the driver.
Studio monitors, for instance, are required to reproduce audio so accurately that anything in the path of the speaker could obscure aspects of the sound, and thus are rarely seen with grilles.
On the other hand, high powered subwoofers (such as those used in high-end car audio applications), produce such violent sound waves that a grille may be susceptible to rattling or damage while the driver is under load.