The measure is active until March 15 and comes after 15 confirmed cases were reported in the country. Hundreds have been tested. Switzerland is in the midst of its carnival season, which draws thousands to many of its cities.
"The Federal Council is aware that this measure will have a significant impact on public life in Switzerland," the government announced in a press release. "However, the move is expected to provide effective protection to people in Switzerland and to public health. It should prevent or delay the spread of the disease in Switzerland, thus reducing its momentum."
All of the confirmed cases in Switzerland had come from people traveling abroad, the government said. The country shares a southern border with Italy, which has seen 650 cases and 17 deaths from the virus so far.
Italy had just three cases of COVID-19 as of Feb. 18, while Switzerland's first case was reported on Tuesday.
"In the case of public or private events at which fewer than 1000 people would gather, event organizers must carry out a risk assessment in conjunction with the competent cantonal authorities to decide whether or not the event can be held," the government added.
The cantons -- Swiss member states -- are responsible for enforcing the ban, the government said.