During the 1918-1919 “Spanish flu” pandemic, neither the federal government or the states took any action and were not expected to so any closings were left to local municipalities. So, here are several examples of actions taken by local municipalities followed by a general conclusion.

https://www.9marks.org/article/how-dc-churches-responded-when-the-government-banned-public-gatherings-during-the-spanish-flu-of-1918/ At the peak of the Pandemic church services were banned in D.C. as part of a ban on all public gatherings on Oct. 3, 1918. The DC Protestant churches called an emergency meeting on Oct. 5 and agreed unanimously to abide by the ban. The African American churches also agreed unanimously to abide by it.
Some tried to get a workaround approved for outdoor meetings but those too were banned.
Once the numbers of deaths began to decline by Oct. 28 pressure began to stop the ban. The ban was lifted on Oct. 31.
During the pandemic, restrictions on public gatherings affected churches. In Washington, D.C., a group of Protestant ministers “voted unanimously to accede to the request of the District Commissioners that churches be closed in the city.” Churches were also closed in cities such as Dallas, Milwaukee, Los Angeles, and Seattle, yet remained open in Chicago and San Francisco. Where there were church closings, there were only a few instances of disobedience. A Baptist pastor in Murray, Kentucky, held services on January 26, 1919 in violation of the state’s ban and was arrested in his pulpit at the evening service. A Catholic priest in St. Louis was allegedly turned in to police after 200 parishioners were seen at the church. The priest told police the people snuck in through the church’s side windows, and he didn’t see them. No charges were pressed.
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1997248/ Lessons Learned from the 1918–1919 Influenza Pandemic in Minneapolis and St. Paul, Minnesota
Very different policies were pursued by the two cities. Despite St. Paul’s principle health official’s conviction that the closing of public places would be ineffective, on November 6 St. Paul’s government officials overruled him and enacted a closing order for the whole city, including schools, theaters, churches, and dance halls. The St. Paul Citizens’ Committee—consisting of 15 physicians, church leaders, and community members who were appointed by St. Paul’s main health official, Dr. Simon—was concerned by the record of 218 new cases on November 5, as well as 36 deaths between November 4 and November 5, 1918, so they recommended this policy change (Figure 1). The number of new cases began to decline 10 days later, with only 24 new cases, and the next day, Dr. Simon reopened St. Paul businesses and churches. While the churches were closed, there were no significant protests from church leaders about the closings.
Minneapolis closed its schools on two separate occasions but not all public places.
When the flu epidemic hit Omaha one of its first fatalities in the City of Omaha, the Rev. Siefke S. de Freese, the 35-year-old pastor of St. Mark’s Evangelical Lutheran Church, had died suddenly after coming down with the Spanish flu symptoms — just days after conducting services and interacting with hundreds of parishioners. At least 25 other Omaha residents were sick with flu.
The city’s health commissioner, Dr. E.T. Manning, knew he had a problem. A big one. After weeks of afflicting East Coast cities, the Spanish flu pandemic had reached Nebraska.
Within 24 hours, Manning issued a sweeping order closing churches, schools, movie houses and theaters, and shutting down public events. He banned spitting in public, and urged people who felt sick to self-isolate. He told people to stop kissing. People who did venture out wore surgical masks.
“Prohibition of public gatherings is the only way known to medical science to check the spread of disease, and I believe we are justified in ordering that to prevent a more serious situation,” Manning said, according to a report in The World-Herald. “I would rather be blamed for being overcautious than to be responsible for a single death.”
Manning’s quick action was credited with saving many lives over the next three months. But Omaha still suffered. Before the end of the year, at least 974 people died in the city of about 180,000 residents, and 14,000 became ill — though both numbers are believed to greatly underestimate the scope of the disease.
The Spanish flu remains the worst natural disaster in Omaha’s history.
The churches complied with the ban until the crisis had passed.

Conclusion: banning worship services was not regarded as some form of religious persecution. It was questioned by churches once the death rates began to go down significantly. Churches complied with few exceptions so public enforcement was not a major issue. It appears that very few, if any, saw the bans as an infringement on their 1st Amendment rights.
So, a good question would be why has that turned into more of an issue in this pandemic over a century later? That’s a topic for another time to deal with.