In the last few weeks, as seems to happen every election  year, both parties along with some pastors and churches are stretching (or breaking) the legal limits on partisan electioneering. On the final Sunday before election day, these activities will likely intensify.
The IRS rule established in 1954 is that tax-exempt organizations, including churches, are "absolutely prohibited from directly or indirectly participating in, or intervening in, any political campaign on behalf of (or in opposition to) any candidate for elective public office." This does not prevent pastors from addressing a range of public issues, encouraging members to vote, or other non-partisan election-related activities.
The general counsel's office of the U.S. Conference of Catholic Bishops has produced a helpful summary of Do's and Don'ts . While geared specifically to Catholic parishes, the guidelines are also true for other churches and pastors. Independent Sector also provides a fact sheet  for section 501(C)(3) organizations, which most churches are.
A simple summary is
If you're interested in more detail, the IRS has a variety of resources available, including a fact sheet on Charities, Churches, and Politics , and a slide show -- Rules for Exempt Organizations During an Election Year . And, of course, if you're in doubt about something, consult with an attorney, preferable one knowledgeable about tax law related to political activity by exempt organizations.
Duane Shank is senior policy advisor at Sojourners.