Then (v 10), the Evangelist gives our Lord's answer. First, our Lord states a general principle; secondly, he applies it to this situation; and thirdly, the Evangelist explains these words of Christ.
He says at first, he who has bathed does not need to wash, except for his feet, but he is clean all over, except for his feet, which touch the earth. We understand from this that the apostles had already been baptized. For he says, he who has bathed, and then adds, and you are clean, that is, because they had been baptized.
Some say they had been baptized only with the baptism of John. But this ...does not seem to be true, because then they would not have bathed, because the baptism of John did not cleanse within from guilt. And so it should be said, according to Augustine, that they had been baptized with the baptism of Christ. If you object that Christ did not baptize but only his disciples, as was stated above (4:2), I say that he did not baptize the crowds, but only his disciples and those he knew well.
But since baptism cleanses even the stains from the feet, it seems that one who has bathed, that is, is baptized, does not need to wash his feet. I answer that if they had left this world immediately after their baptism, they would have had no need for this washing, for since they would be entirely clean, they would go to God at once. But those who live in this world after their baptism cannot reach such perfection that disordered movement of the sensuality in regard to earthly affections never arise. And so it is necessary that they wash their feet either by martyrdom, which is a baptism of blood, or by repentance, which is a baptism of fire, so that they can return to God.
Then when he says, you are clean, but not all of you, our Lord applies this general principle to the situation. But if they were clean, why did our Lord wash them again? Augustine says their hands and heads were clean, but that their feet needed washing. Chrysostom says that they were not absolutely clean, because they had not yet been cleansed from original sin: for since Christ had not yet suffered, the price of our redemption had not yet been paid - but they were clean in a limited sense, that is, from the errors of the Jews. Origen says that they were clean, but that a further cleansing was needed, for reason should always aspire to better gifts, always strive for the heights of virtue, and glow with the brightness of righteousness: "He who is holy, let him be sanctified further" (Rev 22:11). But not all of you, because one of them was dirty both in hands and head.
Source: Commentary on John