Mayor Bill de Blasio said he decided to act because "our city is facing an unprecedented threat, and we must respond with a wartime mentality".
Separately, the US is extending its European travel ban to include the UK and Republic of Ireland.
The US has confirmed 69 deaths linked to the pandemic and 3,774 infections.
New York City - which has the population of more than eight million - has recorded five deaths. Each of the victims - aged 53 to 82 - had underlying health conditions, officials say.
.
President Donald Trump has said the US has "a tremendous testing set up where people coming in have to be tested".
Correspondents say there is a growing sense of unease and confusion in America, with fears of a run on hospital beds and concern about childcare as tens of millions of children are sent home from school. (BBC)