Jesus, if He was to save His people from their sin, had to render perfect obedience to God. We find this truth in passages such as Hebrews 5:8–9, where the author says that Christ was made perfect and the source of eternal salvation because He learned obedience. In other words, Jesus qualified Himself to be the Savior by flawlessly obeying all of God’s commands. He had to render perfect obedience as a man in order for men and women to be righteous in Him before the Father.
Christ rendered obedience to His Father by keeping every statute given to Israel. This included more than just the Mosaic law, for later in the history of the Jews, God sent John the Baptist to command His people to repent and be baptized (Luke 1:5–17; 3:1–6). Thus we have the context for understanding the words of Jesus in Matthew 3:15 that He had to be baptized by John “to fulfill all righteousness.” As Dr. R.C. Sproul has often said, by submitting to John’s baptism, Jesus kept that additional command given to the Jews and thus could stand before God having done all that God had commanded His people to do. Of course, Jesus’ baptism, while a fulfillment of God’s command, was not precisely the same as the baptism that the other Jews received. John pointed out that Jesus had no inherent need for baptism, and Jesus did not correct him (vv. 13–14). In other words, John knew that Jesus did not need to repent because He had no sin. Nevertheless, it was necessary for Jesus to be baptized, so Jesus went through the rite in preparation for His ministry though not as part of repentance, for He had no transgressions for which to repent.
Additionally, Christ’s obedience to God in being baptized is one of the earliest examples we have of Jesus’ identifying Himself with His people. Many commentators over the years have pointed out that by being baptized with His people, Jesus showed His solidarity with them. In His baptism, Jesus became like those He came to save, taking on their duties. There are echoes of substitution here, of Jesus’ placing Himself in the stead of those He came to save. This motif of substitution, of course, becomes more prominent throughout Christ’s ministry, and it reaches its ultimate fulfillment on the cross where He dies as a ransom for many, as the atoning sacrifice who takes the place of His people under divine judgment (Matt. 20:28; Mark 15:34; John 11:49–52). But at His baptism, Jesus began His journey as our substitute in earnest.