It protects it and adds to the sound. If bare wood is exposed, either because of wear or damage, it is important to have an experienced violin repairperson add color and varnish to those areas. Always keep your instrument away from extremes of temperature and humidity. Keep it out of direct sunlight and away from heaters. Avoid putting it in the trunk of a car or in a closed, unoccupied car.
Heat can damage the varnish and cause serious cracks among other things.
Cracks can develop, especially in the spruce top, usually as a result of damage or temperature extremes. If they occur, they should be repaired as soon as possible. If not, the problem may well become worse, and more expensive, to fix. A high quality case is an excellent investment and will go a long way towards protecting the instrument. We have seen too many instruments damaged because they were in an old, poorly padded case.