At the Last Supper, Jesus commands us to "do this in remembrance of me" (cf. I Cor. 11:24); so, why are there stipulations to receive the Eucharist? Why does the Catholic Church seem to put obstacles to fulfilling one of Jesus' commandments?
Firstly, 1 Cor. 11:24 & 25 ("this do ye for the commemoration of me") is not addressed to all of us but to ordained priests with the ability to consecrate, of which the Apostles were.
Secondly, the Church prohibits those in a state of mortal sin (e.g., the divorced and "remarried," who are really adulterers, unless they correct their sinful situation and receive absolution in Confession) from receiving Communion both for the sake of the sinners' souls and for the preservation of the sanctity of this most Holy Sacrament, for, as St. Paul relays (1 Cor. 11:27),
whosoever shall eat this bread, or drink the chalice of our Lord unworthily, he shall be guilty of the body and of the blood of our Lord.
To receive Communion, one must be
Geremia's answer delves into the particular restrictions the Catholic church places on communion, but the "why" of the matter is based on 1 Corinthians 11:
23 For I received from the Lord what I also passed on to you: The Lord Jesus, on the night he was betrayed, took bread, 24 and when he had given thanks, he broke it and said, “This is my body, which is for you; do this in remembrance of me.” 25 In the same way, after supper he took the cup, saying, “This cup is the new covenant in my blood; do this, whenever you drink it, in remembrance of me.” 26 For whenever you eat this bread and drink this cup, you proclaim the Lord’s death until he comes.
27 So then, whoever eats the bread or drinks the cup of the Lord in an unworthy manner will be guilty of sinning against the body and blood of the Lord. 28 Everyone ought to examine themselves before they eat of the bread and drink from the cup. 29 For those who eat and drink without discerning the body of Christ eat and drink judgment on themselves. 30 That is why many among you are weak and sick, and a number of you have fallen asleep. 31 But if we were more discerning with regard to ourselves, we would not come under such judgment. 32 Nevertheless, when we are judged in this way by the Lord, we are being disciplined so that we will not be finally condemned with the world.
33 So then, my brothers and sisters, when you gather to eat, you should all eat together. 34 Anyone who is hungry should eat something at home, so that when you meet together it may not result in judgment.
The church has over time refined its definition of what it means to eat the the bread and drink the cup in an "unworthy manner" and what steps a believer must take to remedy that, but the Apostle Paul set forth the principle originally. The potential consequences for a person who violates this teaching are illness and death, so it is important to heed the teaching. Thus the Church enforces its rules to encourage humble reflection and confession, to promote a lifestyle that will not force God and the church to discipline the believer, to protect life and health. The church does it out of love.
One reason why non-Catholics are not to receive communion at a Catholic Church is that the Eucharist is the sacrament of the unity of the Church, and it would be inconsistent for our separated brethren to essentially state by receiving communion that they are unified with the Catholic Church when in fact they are not. Our desire is that they would come into full communion with the Church, but until that happens, receiving communion is a contradiction. Note these two quotes from the Catechism of the Catholic Church:
1325 "The Eucharist is the efficacious sign and sublime cause of that communion in the divine life and that unity of the People of God by which the Church is kept in being.
1398 The Eucharist and the unity of Christians. Before the greatness of this mystery St. Augustine exclaims, "O sacrament of devotion! O sign of unity! O bond of charity!" The more painful the experience of the divisions in the Church which break the common participation in the table of the Lord, the more urgent are our prayers to the Lord that the time of complete unity among all who believe in him may return.