When a variable is accessible by multiple threads (and possibly multiple physical cores on the hardware/virtualisation) the value may be changed by one
thread but not seen by the other threads.
One situation is a static shutdown variable, where setting it to false kills an otherwise infinite loop. If the shutdown is called by one thread but not seen by the running thread, the process will continue until the updated value is seen and there is not guarantee when this will occur. In a worst case scenario there may be a noticeable amount of time between setting the value and stopping the processing thread.
Stating that this variable is volatile will ensure that the changes are visible across threads and will behave as expected.