Jesus answered, Verily, verily, I say unto thee, Except a man be born of water and of the Spirit, he cannot enter into the kingdom of God. (John 3:5)
Baptism has been hotly debated since at least the time of the ancient Apostles. Some say any ritual washing is baptism, others believe it is just in the heart. It seems from my reading of the Scriptures that it is an essential element in the spiritual progression of everyone who would become a follower of Christ, but I have always wondered why. Why were Jesus' last words to His disciples, "Go ye therefore, and teach all nations, baptizing them in the name of the Father, and of the Son, and of the Holy Ghost?" (Matthew 28:19) In other words: "teach and baptize everyone in the world;" this leaves no one out. It seems so ritualistic, I have been almost inclined toward the half of Christians who believe that "dunking" under water is unnecessary, until I understood why it is necessary.
The problem with Christianity is that we have a conundrum: we cannot be clean without the Holy Ghost, and we cannot have the Holy Ghost without being clean! The answer is repentance. Repentance allows us to "turn away" from our sins or give them up. When we have repented of all our sins, meaning that we “no longer desire to do evil, but to do good continually” we can only then be washed clean through the Holy Ghost and return to God. Baptism is the covenant that allows us to repent.
Covenants are promises that we make to God, and He makes to us. Baptism is the covenant that we will do His will, and in return He will forgive all sins of which we have repented. The Lord keeps His promise based on our promise, "as if" we had already done our part; we are not required to immediately be perfect. The covenant gives us time to repent. We can be forgiven each time we repent so that we can have the Holy Ghost to help us. The Lord never forgets those who have a covenant with Him: "Can a woman forget her sucking child, that she should not have compassion on the son of her womb? yea, they may forget, yet will I not forget thee." (Isaiah 49:15)
Baptism is required of everyone who has ever sinned so they can be clean and enter into the Kingdom of God. Sin is willful rebellion against God and requires two things: knowledge of what is right and wrong, and the ability to choose. Lehi tells us that "men are instructed sufficiently that they know good from evil." (Nephi 2:5) The "light of Christ" is given to everyone so everyone who is old enough to understand can distinguish good from evil. This is why Paul says, "all have sinned, and come short of the glory of God." (Romans 3:23) Children do not need baptism because they can’t sin; they don't have knowledge or understanding. They can transgress a law, but not break it. We would not put a little child in jail for "shoplifting" if he ate some candy in the store because we know, a priori, that he doesn't understand; he has to learn that it's wrong to take things that don't belong to him. Only those who have transgressed a law of God with knowledge need to be baptized.
There is a specified and authorized way to make our covenant with God valid. For example, if I am renting a house and a man pays me for the house he still doesn’t own it. Though he has a legal, signed contract that gives him possession of the house, since I didn’t own the house, and wasn’t authorized by the owner to sell the house, his contract is void. He paid a lot of money for nothing. Likewise, many people make covenants by those who are not authorized to speak for the Lord. Also, we can say we have made a covenant, but if it isn’t done in the Lord’s way it isn’t recognized by Him. For example, my dad loaned a large amount of money to a friend who has never thought to repay the loan. Since there was no written contract, the law doesn't recognize the loan so he has no recourse. In the same sense, if we don't make the covenant with God in His way, we have no recourse. In order to make a valid covenant with the Lord it must be done in His way by His authorized servants.
God cannot be arbitrary; He must be perfectly just. This means every one of His children must be judged by the same standard. The standard He has set is that everyone who has sinned must be “born of the water.” Baptism is the great leveling ordinance. It makes everyone equal in the eyes of God so all can be judged by the same standard. It is simple, direct, and very symbolic. It is an outward sign of an inward commitment, or the token of the covenant. Those who accept the ordinance and fulfill it have a promise from God of forgiveness of sins, but those who don't, don't. "I, the Lord, am bound when ye do what I say; but when ye do not what I say, ye have no promise." (D&C 82:10) This is why everyone must be baptized.