Communion should be a conscious decision based on one’s worthiness to do so.
The Church teaches that abortion or euthanasia is a serious sin and the encyclical Evangelium Vitae asks Christians to oppose these methods. If the law is unjust, it should not be obeyed and they should even oppose civil laws which are contrary to God’s law. It is never licit to cooperate formally in evil and this cooperation can never be justified either by invoking respect for the freedom of others or legal requirements.
Not all moral issues have the same moral weight as abortion and euthanasia. For example, if a Catholic were to be at odds with the Holy Father on the application of capital punishment or on the decision to wage war, he would not for that reason be considered unworthy to present himself to receive Holy Communion. This is part of the diversity of opinions tolerated among Catholics. The minister of Holy Communion may refuse to distribute Holy Communion to someone who has been excommunicated or persistent in committing serious sin. If a politician supports abortion, his pastor should meet with him and remind him of the Church positions. He would have to inform him that he is not to present himself for Holy Communion until he changes his positions. It is not a sanction; it is the consequence of the fact. However, Catholics could vote for him if they do it for reasons different to his positions on abortion and if these reasons are proportionate.

Los Angeles Times (United States)

«Benedict’s Answers to Big Questions», by Joseph Ratzinger, Los Angeles Times, April 20, 2005. Text adapted from a letter written when he was just the prefect of the Doctrine of the Faith sent last year to Cardinal Theodore McCarrick of Washington, some time before US presidential elections.