Near the end of the festival, the priest would pour freshly drawn water on the altar as an offering to God. Allen & Williamson in their Preaching the Gospel say that although this rite originated as a petition for rain, it had developed into a broader statement of salvation. They cite the Babylonian Talmud's explanation of its significance by citing Isaiah 12:3, "With joy you will draw water from the wells of salvation."
Jesus says to them, "Let anyone who is thirsty come to me, and let the one who believes in my drink." John has used water as a metaphor before--The Samaritan woman who asked Jesus for living water (4:1-15) and the crowd who had been fed bread and wanted true bread from heaven (6:25-35).
Allen & Williamson mention several passages that use the metaphor of water; e.g.:
For I will pour water on the thirsty land, and steams on the dry ground; I will pour my spirit upon your descendants, and my blessing on your offspring (Isaiah 44:3).
Then he brought me back to the entrance of the temple; there, water was flowing from below the threshold of the temple....Wherever the river goes, every living creature that swarms will live, and there will be very many fish, once these waters reach there. It will become fresh; and everything will live where the river goes....(Ezekiel 47:1-12)
John tells us that what Jesus was talking about is the Spirit. Since we now know that Modalism is a heresy, we need to be able to interpret "for as yet there was no Spirit," as not meaning that the Spirit did not exist before Jesus. Here's what O'Day and Hylen have to say in their commentary on John:
These words should not be taken as a general statement that Gods Spirit did not yet exist, for John the Baptist makes reference to the Holy Spirit's presence at Jesus' baptism (1:32-33). Instead, the future gift of the Spirit underscores the way in which the Spirit will become known in the life of the church after the death, resurrection, and ascension of Jesus. Jesus' teachings about the Spirit's role in the church are found in the farewell discourse (chapters 14-17), and his gift of the Spirit is narrated in 20:22-23.