After every fall or accident. Even if you do not see any damage on the outside, the helmet may have fine hairline cracks that considerably reduce the protective effect during the next fall.
The materials of a helmet are also subject to ageing. This reduces the protective effect of the material, which is why you should replace your bike helmet after about three to five years.
Too much UV light can also damage the plastics and adhesives. Therefore, you should not store your bike helmet in the sun or in a warm car, as the shell of the helmet can deform.