Throughout the Gospel of John, John uses three sacraments (not two), as a substructure to the narrative, to represent the stages of the Christian life. I say “substructure” because John uses each to talk about what each represents: baptism = regeneration, communion = sanctification in receiving Jesus’ death as a sacrifice to cleanse from sin in the Christian life, and marriage = consummation at the second coming of Christ.
Baptism
In 3:5, water is used to refer to the birth of an individual, and an analogy is made with the new birth by the Spirit. Water turns to wine in 2:1-11 (i.e., allegorically speaking, one’s rebirth, using the ceremonial water for ritual cleansing, turns into cleansing by the blood sacrifice of Christ in his daily life). In 4:7-15, there is a great deal of talk about water and its representation of Jesus giving an eternal water that causes one to never need a drink again. In 7:37-39, the text states:
On the last day of the feast, the greatest day, Jesus stood up and shouted out, “If anyone is thirsty, let him come to me, and let the one who believes in me drink. Just as the scripture says, ‘From within him will flow rivers of living water.’” (Now he said this about the Spirit, whom those who believed in him were going to receive, for the Spirit had not yet been given, because Jesus was not yet glorified.)
The regeneration of the Spirit is represented by the water, but the water does not produce the regeneration of the Spirit. This is the point I want to make with all of this. These sacraments are pictures and nothing more. Jesus isn’t talking about the water at all. He’s using the water as a picture of what the Spirit does.
Jesus is predicted to be the one who baptizes not with water but by the Holy Spirit, the water being used again as an analogy to what the Spirit does, i.e., baptizes/cleanses in justification. Likewise, John contrasts the inability of the cleansing pool in Chapter 5 to heal the lame man with Jesus’ ability to heal him. The water again represents the cleansing, but is not the cleansing itself.
The Eucharist
In 2:1-11, Jesus is presented as the God of the Exodus account who turns water into blood, but the blood here is represented by wine. Likewise, in 19:34, both blood and water flow, and although this is often thought in modern medicine to refer to the piercing of the pericardium, it likely is stated by John as a picture of the communion that consists as wine mixed with water.
The eucharist is used in 6:53-58 to represent Jesus’ sacrifice.
Jesus said to them, “I tell you the solemn truth, unless you eat the flesh of the Son of Man and drink his blood, you have no life in yourselves. The one who eats my flesh and drinks my blood has eternal life, and I will raise him up on the last day. For my flesh is true food, and my blood is true drink. The one who eats my flesh and drinks my blood abides in me, and I in him. Just as the living Father sent me, and I live because of the Father, so the one who consumes me will live because of me. This is the bread that came down from heaven; it is not like the bread your ancestors ate, but then later died. The one who eats this bread will live forever.”
Again, Jesus uses the eucharist to represent His death that must be accepted as the sacrifice for sins. His death, not the bread and wine that only represents it, produces life. Hence, it is presented as eating His flesh and drinking His blood that produces life in the believer, and is done as a picture of his abiding in Christ (a term used to refer to sanctification in John, e.g., 15:1-10).
Marriage
The third, and lesser known and accepted, sacrament in John is marriage. It is somewhat remarkable that all of the sacraments are presented at the beginning of John in Christ’s first miracle: the water, the wine, and it is all done for the purpose of celebrating and establishing a marriage.
In 3:29, John the Baptist identifies Christ as the Bridegroom because He is the one who possesses the Bride.
In 14:1-3, Jesus states:
“Do not let your hearts be distressed. You believe in God; believe also in me. There are many dwelling places in my Father’s house. Otherwise, I would have told you, because I am going away to make ready a place for you. And if I go and make ready a place for you, I will come again and take you to be with me, so that where I am you may be too.”
Here, Christ makes a wedding analogy, where the bridegroom goes to make a place ready in his father’s household to consummate the marriage. Marriage is the picture of the consummation at Christ’s return.
Conclusion
So there are three pictures/sacraments presented in John as representing the Christian life: baptism = justification, eucharist = sanctification, and marriage = glorification. What I want to say then is this. None of them produce what they represent, and the final sacrament, denied to be one by most protestants, would have told us that plainly, as marriage certainly does not produce glorification. It does not bring Christ again. It does not bring about resurrection. It does not produce eternal glory. The act isn’t even mandated for every Christian. It just represents glorification as a picture of it. It’s an analogy, as John has used all the sacraments as analogies throughout the book.
What this tells us is that the other two sacraments are just pictures as well. Like the third sacrament, they do not produce what they represent. They do not produce justication/initial cleansing from sin or sanctification/ongoing cleansing from sin. They’re just pictures of what the Spirit and the gospel do in the life of the Christian.
As marriage does not produce glorification when one does it, water baptism does not produce spiritual cleansing in justification and the communion does not produce God's favor and forgiveness in the continual cleansing of the Christian in sanctification. They all just represent a spiritual reality, but none of them produce that reality or have anything to do with it besides presenting a picture of it.
Hence, there is no magic water or magic bread and wine. That’s a medieval folk tradition that was adopted by the church due to its tendency to place mystical significance to anything religious, like relics, statues, corpses of martyrs, etc.
Like in the Old Testament, the rituals and sacrifices are pictures. They don’t actually cleanse or forgive for sins. They don’t actually produce the coming of the Messiah. They just represent all of these things. Likewise, the rituals in the New Testament do the same thing, and this would have been clearer if protestants had not removed marriage as a sacrament and Roman Catholics and the Eastern Orthodox had noticed John’s own view of them.