Moshe being barred from entering the Land of Israel is a pivotal moment in Jewish history and also one of the more baffling ones.
Why is Moshe kept out of the land? What is the real difference between striking a rock and speaking to the rock? Is there a practical difference beyond G-d's command? And why was Aaron, who appears to have little involvement, also dragged into this?
To begin with, let's examine the two incidents. First early on, not long after leaving Egypt, Moshe is confronted by a crowd demanding water. G-d tells him to strike the rock. He does it. Water comes out. Second, rather late in the journey, as they approach the Land of Israel, the assembly demands water. G-d tells him to speak to the rock. He strikes it instead.
Let's begin by comparing and contrasting the two incidents. Both times Moshe is told to take his staff. But the second time Aaron is included in the command, the first time he is not.
The early plagues and miracles were carried out by Aaron using the staff. The later ones, including the splitting of the sea, were carried out by Moshe with the staff. G-d had told Moshe that he was appointing Aaron as his "prophet", so to speak. Aaron performed lesser miracles, Moshe performed greater ones.
The first miracle has an appearance by Hashem, Moshe is told to strike the rock as he struck the Nile, and the water is mentioned as being only for the people, not their animals. The second miracle has no such appearance mentioned, the water is just meant to come from the rock and the animals will use it as well. The second miracle was meant to be of a more ordinary nature than the first.
In the first incident, the waters are described as Massa and Merivah. A test of G-d and quarrelsome.behavior. The "test" defined the structure of the miracle. "Because they tried the LORD, saying: 'Is the LORD among us, or not?'"
Accordingly the miracle was meant to answer this test by showing that G-d was here and would meet their needs in a dramatic way.
The second incident is only described as Merivah, quarrelsome. This time, after all these decades, the Jews no longer tested or doubted G-d. We can see this in the different phrasing.
'Wherefore hast thou brought us up out of Egypt, to kill us and our children and our cattle with thirst?' is how it's phrased in the first incident.
"And why have ye brought the assembly of the LORD into this wilderness, to die there, we and our cattle?" is how it's phrased in the second incident.
The second time they are taking issue with Moshe's leadership while recognizing G-d's ultimate leadership, as their phrasing shows. They are no longer testing G-d, they are however testing Moshe.
While the miracle of the first incident was primarily meant to address their testing of G-d, the miracle of the second incident was meant to deal with their attitude, their quarrelsome approach. This time Moshe and Aaron, as teachers, were expected to set an example by speaking to the stone, showing the people how to pray to G-d, rather than carry on the way they were doing.
This was not meant to be a showy miracle. It would be miraculous, but in a more ordinary way. It would show that you can ask Hashem for things and He will give them to you. And this was where they failed. Moshe fell into the same behavior that he was trying to dissuade. Like a father who begins yelling at his son, instead of guiding him, he set the wrong example. And that is why G-d declared Moshe and Aaron unfit 'parents' to bring the people into the land.
A miracle contains within it a lesson. By forcing the wrong miracle, Moshe taught the people the wrong lesson. He had been with them for so long, that like a parent, he had failed to realize that they had made progress. Instead he treated them as if they were no different than they had been 40 years ago. He berated them and struck the rock, instead of showing them that there was a better way, that not only the power of the staff could bring water from the stone, but so could the word of G-d.