The Code of Canon Law states:
Every person not yet baptized and only such a person is able to be baptized.
(Canon 864; emphasis added)
Here's what the Catechism of the Catholic Church has to say about baptism and why it can only be received once:
Incorporated into Christ by Baptism, the person baptized is configured to Christ. Baptism seals the Christian with the indelible spiritual mark (character) of his belonging to Christ. No sin can erase this mark, even if sin prevents Baptism from bearing the fruits of salvation. Given once for all, Baptism cannot be repeated.
(Catechism, paragraph 1272)
In other words, baptism (the first time) marks a person out as belonging to Christ. It is a consequence of this marking (the "seal" of Baptism) that a person is made part of the Body of Christ, purified from original sin, and given justifying and sanctifying grace:
Baptism not only purifies from all sins, but also makes the neophyte "a new creature," an adopted son of God, who has become a "partaker of the divine nature," member of Christ and co-heir with him, and a temple of the Holy Spirit.
The Most Holy Trinity gives the baptized sanctifying grace, the grace of justification:
enabling them to believe in God, to hope in him, and to love him through the theological virtues;
giving them the power to live and act under the prompting of the Holy Spirit through the gifts of the Holy Spirit;
allowing them to grow in goodness through the moral virtues.
The baptized have become "living stones" to be "built into a spiritual house, to be a holy priesthood" By Baptism they share in the priesthood of Christ, in his prophetic and royal mission. They are "a chosen race, a royal priesthood, a holy nation, God’s own people, that [they] may declare the wonderful deeds of him who called [them] out of darkness into his marvelous light." Baptism gives a share in the common priesthood of all believers.
If someone is inadvertently re-baptized, nothing particular happens. The person has already been marked out as part of Christ's flock; has already been made part of the Mystical Body of Christ. A second baptism has no effect on that:
Baptism imprints on the soul an indelible spiritual sign, the character, which consecrates the baptized person for Christian worship. Because of the character Baptism cannot be repeated.
(Catechism, paragraph 1280)
No penalty or censure is attached by the Church to conferring or receiving a second baptism (inadvertently or otherwise); however, the importance the Church places on baptizing only once can be seen in their instructions (in the Code of Canon Law) to priests on baptizing those who might possibly have been baptized before (including in another Christian community whose baptism is recognized as valid):
Canon 869 §1. If there is a doubt whether a person has been baptized or whether baptism was conferred validly and the doubt remains after a serious investigation, baptism is to be conferred conditionally.
[That is, the priest is required to carry out a thorough investigation, and if after that the priest has any reason at all to believe that the person might possibly have been baptized, he is to give only a conditional baptism—saying not "I baptize you" but instead, effectively "If you haven't been baptized, I baptize you."]
Canon 869 §2. Those baptized in a non-Catholic ecclesial community must not be baptized conditionally unless, after an examination of the matter and the form of the words used in the conferral of baptism and a consideration of the intention of the baptized adult and the minister of the baptism, a serious reason exists to doubt the validity of the baptism.
[If someone has been baptized by another Christian denomination, they're presumed to have been baptized validly, and thus will not be re-baptized at all—even conditionally—unless there is serious reason to believe that the Catholic Church doesn't recognize that baptism as valid.]
Canon 869 §3. If in the cases mentioned in §§1 and 2 the conferral or validity of the baptism remains doubtful, baptism is not to be conferred until after the doctrine of the sacrament of baptism is explained to the person to be baptized, if an adult, and the reasons of the doubtful validity of the baptism are explained to the person or, in the case of an infant, to the parents.
[So if the priest determines that the person has, or may have, already been baptized, he needs to explain to the adult baptizand or to the parents just exactly why the Church considers them already baptized, and why they're going to be baptized conditionally or not at all. They have to understand what's going on and why.]
Canon 870 An abandoned infant or a foundling is to be baptized unless after diligent investigation the baptism of the infant is established.
[Even in the case where there aren't any parents available, you still have to investigate the possibility that a child might have been baptized.]
This is something the Church takes quite seriously, even though it doesn't penalize for it. To make it easier to discover whether someone has been baptized, the Church requires priests who baptize to make a record of the fact in the permanent parish record:
The parish priest of the place in which the baptism was conferred must carefully and without delay record in the register of baptism the names of the baptised, the minister, the parents, the sponsors and, if there were such, the witnesses, and the place and date of baptism. He must also enter the date and place of birth.
(Code of Canon Law, Canon 877, section 1)
And this record needs to be duplicated in the diocesan records as well:
A diocesan bishop is to take care that the acts and documents of the archives of cathedral, collegiate, parochial, and other churches in his territory are also diligently preserved and that inventories or catalogs are made in duplicate, one of which is to be preserved in the archive of the church and the other in the diocesan archive.
(Code of Canon Law, Canon 491, section 1)
Thus, even if the pastor doesn't know whether someone has been baptized, he needs to at least ask where they grew up—the chancery office (administrative division) of the diocese including that city or town will have a record of any such person being baptized.