One cannot just decide to stay out of work, but the obligation to work based on an employment contract applies during virus epidemics as well. In many workplaces arrangements to work remotely are being used, if allowed by the type of work.
Employees may stay out of work if their presence at home is necessary e.g. to take care of small children as daycare centres or schools have been closed down. The law does not entitle to paid absence in such cases, but there may be regulations concerning this in the collective agreements. People should check if this is the case.