In the next chapter, we discover that Miriam and Aaron spoke against Moses because he married a Cushite woman. Miriam learns about this inadvertently, but by relating what happened innocently is still punished for criticizing Moses. Aaron intentionally criticizes Moses which was worse. God gets mad at Miriam and Aaron, and causes an affliction (tzara'ath) on Miriam. Moses cries out to God to heal her. She was confined outside the camp for seven days and then could return.
Lessons: Don't speak poorly of another, even by accident.
And don't complain when you are released from slavery because you don't have meat. Take what you have.