In 20:2-8, we find Miriam has just died. With her went the "Well of Miriam" which had been the source of water for the Israelites.
the people find themselves in the desert with no water. They come to Moshe and complain that they have no water and how could he bring them in the desert to die... and Hashem tells Moshe to speak to the rock to draw out water for the nation.
What changed? In the previous few parshiyos, we encountered a number of incidents in which the people complained and Hashem punished them. He sent them plague to kill them, or too much meat, etc.. Why this time does Hashem provide them with water in this fashion instead of punishing them for the complaints like He did previous times?
Here they were complaining about a lack of water. In previous incidents they complained about a lack of luxuries , or about questioning leadership, etc.
The complaint here about lack of water is legitimate. People need water to live. It is a basic necessity. For this type of complaint there is no need to punish them.
Yes, it also might indicate a weak level of emuna - faith in Hashem's ability or capability to provide for them. They should have, after all they have seen and been through, been confident that Hashem would find them a new source for water.
That, however, is not a reason to punish them, rather a reason to educate them. Hashem has to now provide for them a lesson in emuna. That is why His response is not to just find them a pool of water in the desert. Rather, He makes it into a whole lesson. he brings them to a rock and instructs Moshe to draw water from the rock. That was going to be a lesson in emuna, at the same time as providing the water they needed.