Churches and other houses of worship in the United States are ordinarily exempt from paying taxes under Section 501(c)(3) of the tax code, having complied with various legal requirements such as registering with their states as nonprofit organizations.
In order to maintain their nonprofit (tax-exempt) status, however, a church's activities must be limited. In particular, the church (which term we'll use generically here) must refrain from straying too far into activities outside its mission, and must not break the law. What does that mean for churches that wish to offer sanctuary to undocumented immigrants?
While churches have a long tradition of offering sanctuary to immigrants who are fleeing difficult situations and finding a cold reception in the United States, the issue has taken on immediate urgency as the administration of Donald J. Trump has embarked upon efforts to deport virtually all undocumented immigrants within the U.S., without regard for traditional enforcement priorities—which formerly emphasized focusing on criminal aliens rather than those with community connections and family ties.
Federal law prohibits anyone from concealing, harboring, or shielding from detection any alien who is in the U.S. in violation of the law. (See the Immigration and Nationality Act at I.N.A. Section 274(a)(1)(A)(iii).) Even those who conspire with regard to or aid or abet any of the above are in violation of this law. Such violations are considered crimes, and potentially subject the perpetrator to fines and prison time.
One bit of good news for anyone offering sanctuary out of a sense of moral obligation: The possible imprisonment period is reduced for those whose violation was NOT for financial gain; from ten years to five. But there is no actual, explicit exemption for churches and such.
Typically, when one looks into types of illegal activity that can put a nonprofit's status at risk, the discussion focuses on actions that profit private individuals. This is not such a situation. Nevertheless, the IRS can revoke the tax exemption of a charitable organization that engages in any behavior that is illegal or violates public policy. Because tax exemption can be considered a sort of government subsidy, the government has every interest in not extending those subsidies to illegal activity.
What's more, many of the court opinions dealing with nonprofit status (or the loss thereof) emphasize that nonprofits' tax exemption is partly justified by the role they play in reducing burdens on the government by providing public benefits. It follows that working directly against the government doesn't put the nonprofit in a strong legal position.
Nevertheless, there's a legal distinction to be made between a nonprofit whose primary purpose is to conduct illegal activity—to use a common example, running a school for pickpockets—and one that engages in some illegal activity in addition to acting in accordance with its mission. The former is a much more direct path to loss of tax exemption (or failure to gain it in the first place). It's unlikely that any church could be accused of existing solely to offer sanctuary to undocumented immigrants (unless it was formed in direct response to Trump's immigration-related orders).
In the case of a church that spends some of its efforts on illegal activity, the question becomes whether that activity is truly "substantial" relative to the nonprofit's other work. The criteria for measuring this include how serious the offense is, how deeply involved the organization's officers and directors are, and how much time and attention the organization devotes to the illegal activity. If a church's entire focus switched to providing sanctuary at the expense of its normal activities, that could be a problem for its maintaining tax exemption.
The IRS is under-resourced as it is, so the extent to which it will take action against—or even notice—churches that offer sanctuary is questionable. Historically, the IRS has taken action against some churches that offered sanctuary, specifically in the 1980s when war in Latin America created a rush of asylum seekers. But that was decades ago, so it's difficult to draw a message from it.
Also, if law enforcement officials haven't themselves taken action against your church, the IRS is not supposed to rush to make its own conclusions about what is or isn't illegal behavior.
One area of concern might be who, exactly, your church ends up harboring—a law-abiding family versus a known criminal or terrorist, for example. Some experts recommend developing a screening policy so that sanctuary is available only to those who pass your stated criteria. A lawyer can help craft this document and otherwise analyze the level of risk that your church is taking on by offering sanctuary to undocumented immigrants.