ROME—Italy’s effort to fight the worst coronavirus epidemic outside China by quarantining 17 million people began in confusion on Sunday, as transport services continued, enforcement wasn’t yet evident and Italians wondered how it was meant to work.

A government decree that took effect on Sunday bans people from entering or leaving large swaths of northern Italy, including the cities of Milan, Venice and Parma and much of Italy’s industrial heartland.

Residents of the quarantine zone aren’t allowed to travel within it, employees are asked to take leave and at-risk groups such as the elderly to stay in their homes. The decree says police and army can be deployed to enforce the quarantine if necessary. People found breaking the rules can, in theory, face up to three months in prison.

“This is a national emergency,” said Prime Minister Giuseppe Conte. “Our objectives are twofold: to contain the spread of infections—we can’t afford it—and we have to take action to prevent the overloading of our hospitals.”

But there were soon questions about the effectiveness of the measures Mr. Conte announced.