You ask a good question....why do we need to be baptized? Jesus himself not only taught it, but through his example demonstrated that baptism was an essential ordinance in order to return to live with our father in Heaven. He states in John 3:3-5 the following:
3 Jesus answered and said unto him, Verily, verily, I say unto thee, Except a man be born again, he cannot see the kingdom of God.
4 Nicodemus saith unto him, How can a man be born when he is old? can he enter the second time into his mothers womb, and be born?
5 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.
There are two things that Jesus is talking about in these verses. First he talks about a "born again" experience that helps us see the Kingdom of God. Most Christians go through this stage at some point. It happens when they gain a desire to follow Christ and to make changes in their lives. This process causes them to "see" themselves as spiritual pilgrims one day home again in God's presence or Kingdom.
In verse 5 however, we learn that there are certain things we must "do" if we are to actually "enter" that Kingdom. Jesus talks about being born of water and of the spirit. In the LDS faith this is babtism and the gift of the holy ghost.
When Jesus was babtized in Matthew 3:13-17 we read:
13 ¶Then cometh Jesus from Galilee to Jordan unto John, to be abaptized of him.
14 But John forbad him, saying, I have need to be baptized of thee, and comest thou to me?
15 aAnd Jesus answering said unto him, bSuffer it to be so now: for thus it cbecometh us to dfulfil all erighteousness. Then he suffered him.
16 And Jesus, when he was abaptized, went up bstraightway out of the water: and, lo, the heavens were opened unto him, and he saw the cSpirit of God descending like a ddove, and lighting upon him:
17 And lo a avoice from heaven, saying, This is my bbeloved cSon, in whom I am well pleased.
(sorry about the extra letters above - they are footnotes that copied over)
Here we see a perfect God being baptized, despite the fact that he needed no cleansing, he showed us His example and fulfilled the requirements that we too must fulfill.
As to why does God require baptism? I don't know. Why can't we just make some internal commitment like, "I will follow thee". My guess is that our Father in Heaven is a God of order. Sociologists would point out that studies show that those who go through a public display (like baptism or marriage) of an inner commitment they've made are more likely to keep it. At this point these are just my opinions.
The Book of Mormon offers a great explanation which I would like to share. It is found in 2nd Nephi 31:7-9
7 Know ye not that he was holy? 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 aobedient unto him in keeping his commandments.
8 Wherefore, after he was baptized with water the Holy Ghost descended upon him in the aform of a bdove.
9 And again, it showeth unto the children of men the straitness of the path, and the narrowness of the agate, by which they should enter, he having set the bexample before them.
Hope this helps