4 Then the LORD said to Moses, "Behold, I am about to rain bread from heaven for you, and the people shall go out and gather a day's portion every day, that I may test them, whether they will walk in my law or not.
5 On the sixth day, when they prepare what they bring in, it will be twice as much as they gather daily."
Having escaped the dangers of Egypt by God parting the waters of the sea, Israel are now passing through the desert, on their way to the promised land. Their trust in God is tested again when they become hungry, and they have no food in the desert to feed the multitude of people.
God comes to the rescue once again, continuing to show that they should not complain and rebel, but trust in him. He promises to rain bread from heaven so that all they must do is go outside and collect it.
The people are not to collect more than they need for a particular day, except on the day before the rest day. Even in this, with God commanding them clearly and miraculously delivering them time after time, many do not trust and collect extra so that they have enough for the next day (not a rest day). They fail to trust God for their daily bread and the extra turns into worms.