In the third chapter of Matthew we read of the baptism of Jesus Christ. Our Savior approached John the Baptist, his cousin, who had the priesthood authority to baptize. John had just explained to his disciples that his baptism was unto repentance and that more was to come from someone more authorized than himself.
Then cometh Jesus from Galilee to Jordan unto John, to be baptized of him. But John forbad him, saying, I have need to be baptized of thee, and comest thou to me? And Jesus answering said unto him, Suffer it to be so now: for thus it becometh us to fulfil all righteousness. Then he suffered him. And Jesus, when he was baptized, went up straightway out of the water: and, lo, the heavens were opened unto him, and he saw the Spirit of God descending like a dove, and lighting upon him: And lo a voice from heaven, saying, This is my beloved Son, in whom I am well pleased.
As John learned at the baptism of Christ, there is more to baptism than repentance only. It is true that baptism washes away our sin, but it does so because with our immersion in water we enter into a certain covenant. We promise God that we will be willing to take upon ourselves the name of Christ, always remember him and keep his commandments. God promises us the gift of the Holy Ghost.
The key phrases in that covenant are that we are willing and that we take upon ourselves the name of Christ. I've written about willingness before here. Taking upon ourselves the name of Christ includes, among other things, literally accepting his name just as a bride accepts the name of her groom. Just as the union of two people by marriage allows them to be seen legally and otherwise as one family unit, the union of individuals to Christ by baptism allows us to be seen by the laws of God as one unit together with Christ.
Our baptism is the covenant by which we can become unified with Christ and, therefore, judged as one with him if we keep the rest of the covenant, i.e. if we remain willing and obedient. As fallen men and women, each of whom has committed sin(s), this is the only way we may be judged worthy to enter God's kingdom.
That is a little different story for our Savior, Jesus Christ. Free from the burdens of sinful disobedience, he was the only person with the capacity and power to return to live with God independent of outside assistance. He did not need baptism to be clean from sin. So why was he baptized?
Christ told John he was baptized to, 'fulfil all righteousness'. Nephi had the same answer, noting only the valuable example it would provide for the rest of us:
And now, if the Lamb of God, he being holy, should have need to be baptized in water, to fulfil all righteousness, O then, how much more need have we, being unholy, to be baptized, yea, even by water!... But notwithstanding he being holy, he showeth unto the children of men that, according to the flesh he humbleth himself before the Father, and witnesseth unto the Father that he would be obedient unto him in keeping the commandments (2 Nephi 31:5, 7)
Righteousness refers to actions that are justified with or pleasing to God. The opposite of sin, righteousness simply means acting according to the will of God. Fulfilling all righteousness would then be doing everything according to the will of God. It is perfect righteousness.
Christ completed his mission to fulfill all righteousness. Even in the excruciating moments of Gethsemane, he prayed, 'O my Father, if this cup may not pass away from me, except I drink it, thy will be done' (Matthew 26:42). He did everything God asked of Him-- yet, that doesn't seem to completely explain why a perfect man, our Creator and Savior, was baptized.
Perhaps Christ was not baptized for repentance, but rather to enter into the same covenant that we do when we are baptized. A bride cannot be married if the groom is not present. Perhaps he covenanted with God to give his name to us-- even to suffer, bleed and die for us-- if we would be willing to accept it through our individual faith, repentance, baptism, gift of the Holy Ghost and enduring to the end. As a bride and groom entering the marriage covenant, perhaps Christ was baptized because He loves us dearly and wants to help and guide and provide for us.
These are only my thoughts, so perhaps some caution would be wise. Yet in them reside a few certain truths: Jesus Christ is our Savior and our perfect example, he was baptized by immersion by someone authorized to do so, he loves each of us and he wants us to return to live with our Heavenly Father. This can only happen if we follow his example:
And whoso believeth in me, and is baptized, the same shall be saved; and they are they who shall inherit the kingdom of God. And whoso believeth not in me, and is not baptized, shall be damned. Verily, verily, I say unto you, that this is my doctrine, and I bear record of it from the Father (3 Nephi 11: 33-35).