As stated in the IRS Website:
Under the Internal Revenue Code, all section 501(c)(3) organizations 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. Contributions to political campaign funds or public statements of position (verbal or written) made on behalf of the organization in favor of or in opposition to any candidate for public office clearly violate the prohibition against political campaign activity. Violating this prohibition may result in denial or revocation of tax-exempt status and the imposition of certain excise taxes.
Certain activities or expenditures may not be prohibited depending on the facts and circumstances. For example, certain voter education activities (including presenting public forums and publishing voter education guides) conducted in a non-partisan manner do not constitute prohibited political campaign activity. In addition, other activities intended to encourage people to participate in the electoral process, such as voter registration and get-out-the-vote drives, would not be prohibited political campaign activity if conducted in a non-partisan manner.
On the other hand, voter education or registration activities with evidence of bias that (a) would favor one candidate over another; (b) oppose a candidate in some manner; or (c) have the effect of favoring a candidate or group of candidates, will constitute prohibited participation or intervention.
The Internal Revenue Service provides resources to exempt organizations and the public to help them understand the prohibition. As part of its examination program, the IRS also monitors whether organizations are complying with the prohibition.
To learn more, download one or both of the following PDF documents provided by the IRS:
21 Examples of What Political Activity Is and Is Not (using real scenarios)
Prohibited Political Activity for 501(c)3 Non-Profit Organizations/Rules for an Exempt Organization During an Election Year