This story represents a archetype of Christ and His sacrifice. In the first situation, to obtain salvation (water), Moses was told to strike the rock (representing Christ’s suffering and death for our salvation). The second time, salvation had already been provided, so Moses only needed to ask for it (speak to the rock). Instead, he struck it again, thus changing the message God was trying to show His people through this archetype. Christ’s sacrifice only needed to happen once. After that, all those who “call upon the name of the Lord” will be saved.
As always, God explained His symbolism:
"...they drank from the spiritual rock that accompanied them, and that rock was Christ." 1 Cor. 10:4, and
"...whoever drinks the water I give them will never thirst. Indeed, the water I give them will become in them a spring of water welling up to eternal life. John 4:14.
So:
Moses/Law
strikes/crucifies
Rock/Christ
once for salvation, then
speaks/prays
afterward for fellowship with the Spirit, as in John 7:37-39: "...Jesus stood and said in a loud voice, Let anyone who is thirsty come to me and drink. Whoever believes in me, as Scripture has said, rivers of living water will flow from within them. By this he meant the Spirit, whom those who believed in him were later to receive."