The 1689 Baptist Confession says this about Baptism:
Baptism is an ordinance of the New Testament, ordained by Jesus Christ, to be unto the party baptized, a sign of his fellowship with him, in his death and resurrection; of his being engrafted into him; of remission of sins; and of giving up into God, through Jesus Christ, to live and walk in newness of life.
Those who do actually profess repentance towards God, faith in, and obedience to, our Lord Jesus Christ, are the only proper subjects of this ordinance.
Romans 6:3-4 says:
Do you not know that all of us who have been baptized into Christ Jesus were baptized into his death? We were buried therefore with him by baptism into death, in order that, just as Christ was raised from the dead by the glory of the Father, we too might walk in newness of life.
A study note from the ESV Study Bible says that baptism "is an outward, physical symbol of the inward, spiritual conversion of Christians." If all of this is true about baptism, which it is, then why was Jesus baptized? Jeff Vanderstelt wrote:
Jesus was not baptized because he had sinned. He did it to identify with sinners-those who need to turn to God for forgiveness. In his righteousness, he identified with our sinfulness. He did not come for the righteous; he came for sinners (Mark 2:17). In his baptism, Jesus was saying: "I will identify with you so that you can identify with me. I will take on your sin so you can take on my righteousness."
Jesus suffered and was tempted just as we are yet was without sin (Hebrews 2:18; 4:15) and God made him who knew no sin to be sin so that in him we might becomes the righteousness of God (2 Corinthians 5:21). We are baptized after our confessing Jesus as Lord, we are demonstrating the work of the Gospel in our lives and identifying to be renewed by the Spirit. We can walk in the newness of life because Jesus did for us and died in our place. His baptism is a reminder that he identifies with us. He is our Great High Priest who took to the waters of baptism not because of his sin (he had none) but to identify with his people whose sin he was to take upon himself on the cross.