The First Amendment to the US Constitution begins "Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof...."
But what is "an establishment of religon"--a local church building? an organization? What did those words mean to the people of that time, especially the ones who worked out the Constitution in 1787 and the first ten Amendments, now called the Bill of Rights?
At that time, most countries in Europe had an "established church"--a church linked to the government, often supported with tax money, and intended to be dominant in that country. In England, it was the Anglican Church; and it not only received money from the government, but the bishops and archbishops of the Church of England automatically had seats in the House of Lords. The Scandinavian countries and some states of German set up Lutheran state churches. In a few places, it was Reformed churches that were the choice--Scotland's official church was Presbyterian, separate from the Anglican Church next door in England, even though they shared the same king. And of course, some countries remained Roman Catholic--France, Spain, Italy, Austria and some parts of Germany, and others. But one thing that went along with being the favored church in a country was the official effort to put down and eliminate all others. This started during the Reformation in the 1500s, and continued for several centuries. Even where dissenting groups were allowed to exist, they were discriminated against and put at a disadvantage.
For instance, in England: if you did not take Communion in an Anglican church building, you could not hold any political office, national or local. In Ireland, which was under English rule, you were not only kept from holding any office, the government would not recognize your marriage as legal unless it was performed in an Anglican church building. This affected not only the Irish Catholics, but also the Protestant Ulster Scots, who were settled there in the early 1600s to help hold down the country after major revolts in the reign of Elizabeth I.
Most of the English colonies that became the United States had their established churches, too. Virginia and most of the other southern colonies had made the Anglican church their official one; in Massachusetts and some of the other New England colonies it was the Puritans (by then called Congregational Church; after several mergers in the 1900s it is now the United Church of Christ). Pennsylvania, one of the later colonies to be founded, was the first to welcome all comers, no matter what sect they were part of. These colonial established churches had continued after the American Revolution. (The Anglican churches had re-organized and re-named themselves as the Episcopal Church, with their first bishop on this side of the Atlantic--before the Revolution they had been under the authority of the Bishop of London.)
The established churches in Europe tended to be dominated by the nobility and royalty, regardless of whether they were Catholic or Protestant. There had been a long tradition in noble families in Europe; one son inherited the estates, one went into the army, and one son for the church. Henry VIII of England was not intended to be king--his older brother was to be the heir to the throne. Henry was expected to end up Archbishop of Canterbury, the top bishop in the country. But Henry's older brother died young, and Henry inherited the throne instead.
And it wasn't just royalty doing this. In general, all over Europe, the bishops, archbishops, the cardinals, and other top church positions mostly went to the sons of the nobility. And little to no importance was put on the son's fitness or morality in all too many cases.
And social position affected church position all down the line. In the Church of England, a young man from an upper-class family would be ordained, and would be assigned several churches. He would take the best one--the wealthiest, most prominent socially--and farm out the others to clergymen of lower status, paying them as little as half the official salary and keeping the rest for himself. Samuel Wesley, the father of John and Charles who later founded Methodism, was one of those lower-class preachers. It isn't commonly known today, but Charles Darwin studied for the Anglican ministry. He admitted to friends that he felt no particular calling; but he wanted to go to university; Anglican ministry was considered an acceptable profession for one of his family's social status, and so his father would pay for him to go to Cambridge University. He never was ordained; it is possible he went on that sea voyage on the Beagle, that got him thinking about evolution, to get away from his father's demands that he get ordained and take his share of churches.
That is the background of the term "establishment of religion" that the Founders had lived with. And somehow they made the decision that the new nation would not have an Established Church. In so doing they avoided a breakup of the new country. The New Englanders would never have accepted another Anglican establishment; the southern states would never have accepted a Puritan national church. And by that time there were plenty of other groups--Presbyterians, Methodists, Baptists, Quakers, as well as smaller groups like the Moravians, Amish and Mennonites, and more. And over time the states that had established churches cut them loose, and the new states that came in never bothered. In the new United States, each church, no matter what kind, had to make its own way, without official government help and money.
And what about "prohibiting the free exercise thereof"? There had been plenty of that in Europe and the colonies in the past. I mentioned the restrictions put on other groups by the established churches in Europe. It was not much better in most of the American colonies. Quakers and others were persecuted in New England; in Virginia non-Anglicans were not allowed to have their own churches for many years. That rule was ignored sometimes, because they needed the hardy Ulster Scots who were settling the backwoods areas of the colonies, to provide a buffer against the Indian tribes farther west. But it remained on the books for a long time.
Against that background, the new American republic tried something new, a country without one dominant favored denomination, where all were free to worship as they believed they should.
And yes, this is history; but it also affects us today. During the COVID-19 pandemic we are living these days, some governors of states tried to restrict churches from having services, limiting how many could attend, even if they practiced physical distancing and using masks and other precautions, and without regard for how much room they had to spread out in. (For instance, saying stores could operate at 50% capacity, but churches could only have 10 or 25 people, even if their building could seat hundreds.) Some churches (and some Jewish synagogues) complied quietly; others questioned why they were treated worse than stores and other social settings. And finally the Supreme Court ruled that states could not put harsher restrictions on churches than they did on other places. And court cases in recent years have reminded local governments that while they must not favor any one religion over another, they also must not show disfavor to religious groups either.