Catholics
The main requirement for a Catholic who has received First Communion is that the person must be in a state of grace (the person has been to confession since committing a mortal sin). As for divorced and remarried persons, non-marital intercourse is a mortal sin and divorces are not recognized by the Catholic Church so...
The person must also believe in the doctrine of transubstantiation. This is one of the major differences in Communion between the Catholic Church and Protestant churches, and the words used in the Communion Rite reflect it (the Eucharistic minister declares "The Body of Christ" as the host is given, and the person receiving it answers with an affirmative "Amen").
The person also must have observed the Eucharistic fast (only water and medicine within an hour before Communion).
Another important requirement that almost goes without saying is that the person must not be under an ecclesiastical censure (e.g. excommunicated). This might also apply to a divorced and remarried person.
Catholic children are admitted to Communion once they have received their First Communion.
Non-Catholic Christians
The person may be allowed to receive Communion depending on the Christian denomination the person belongs to. In the missals at a Catholic Church you will find a message like this one:
We welcome our fellow Christians to this celebration of the Eucharist as our brothers and sisters. We pray that our common baptism and the action of the Holy Spirit in this Eucharist will draw us closer to one another and begin to dispel the sad divisions which separate us. We pray that these will lessen and finally disappear, in keeping with Christ's prayer for us 'that they may all be one'. Because Catholics believe that the celebration of the Eucharist is a sign of the reality of the oneness of faith, life, and worship, members of those churches with whom we are not yet fully united are ordinarily not admitted to Communion. Eucharistic sharing in exceptional circumstances by other Christians requires permission according to the directives of the diocesan bishop and the provisions of canon law...
If the Christian belongs to a denomination that the Catholic Church is considered "fully united" with then that Christian will be admitted to Communion. Otherwise, the person is generally not admitted, although there are exceptions. The Guidelines for the Reception of Communion from the United States Conference of Catholic Bishops (USCCB) provides a list of the denominations whose members are permitted to receive Communion:
Members of the Orthodox Churches, the Assyrian Church of the East, and the Polish National Catholic Church are urged to respect the discipline of their own Churches. According to Roman Catholic discipline, the Code of Canon Law does not object to the reception of communion by Christians of these Churches (canon 844 § 3)
Non-Christians
Non-Christians are not admitted to Communion.
The message in the missals from above continues:
We also welcome to this celebration those who do not share our faith
in Jesus Christ. While we cannot admit them to Communion, we ask them
to offer their prayers for the peace and the unity of the human
family.
Scriptural Basis
The scriptural basis for the Catholic Church's teaching is mainly based on 1 Corinthians 11:27-29:
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. Everyone ought to examine themselves before they eat of the bread and drink from the cup. For those who eat and drink without discerning the body of Christ eat and drink judgment on themselves.
Clearly, these verses indicate that Catholics must be in a state of grace when receiving Communion. Also, non-Christians do not acknowledge Christ as Lord and would therefore receive it in an unworthy manner. Similarly, non-Catholic Christians who do not believe in transubstantiation would receive Communion in an unworthy manner according to Catholic teaching.
You can find more details, including exceptions, at Catholic Answers and the USCCB Guidelines for the Reception of Communion. The above missal quotes are derived from the USCCB guidelines.