"Speak now in the ears of the people, and let every man borrow of his neighbor, and every woman of her neighbor, jewels of silver and jewels of gold." (Exodus 11:2). Why did God command the Israelites to ask for gold and silver although He knew they will wonder in the wilderness for 40 years and precious metals are of no use in the wilderness, especially since they used that gold later to make an idol to worship? Was it not more beneficial for the Israelites to ask for objects made of iron and brass, etc.?
Although one might speculate that God may have wanted to test the Israelites by providing them with excess in which they may choose foolishness, but in reality, ultimately much of the precious metals were used for the construction of the Ark of the Covenant and its furnishings and craftsmanship which began in Exodus, Chapter 25.