Salam Dear Lina,
Thank you for your interesting question and for contacting Ask About Islam.
God bestows material wealth and poverty upon individuals for reasons known only to Him. For example, a poor person might inherit wealth when a rich family member or relative dies. Some people inherit intelligence, shrewdness, and business acumen, while others who could undertake these responsibilities successfully are denied the chance to do so.
The Prophet is reported to have said that God bestows this world’s goods upon whomever He pleases, but knowledge only upon those who petition Him for it.
This hadith, although defectively transmitted, is most significant. Clearly, material possessions should not be seen as necessarily good in themselves. God does not always bestow material security and happiness upon those who ask Him for such things.
There is good in whatever He bestows. For the faithful individual who does good deeds and gives in charity some of what has been bestowed, wealth is a means of good. If, however, the individual is of weak faith and has strayed from the path of right action and charity, wealth becomes a means of evil.
For someone who has deserted the path of right action, poverty might be just the excuse needed to engage in inner or outer (or both) rebellion against God.
Those who do not submit totally to God, or who do not try sincerely to act upon the teachings of Islam, will find their wealth a means of distress, a severe and demanding test: Know that your children and your worldly goods are but a trial and a temptation, and that God’s reward is great (8:28).
We should recall here a saying of the Prophet: “Among you are such people that if they raise their hands and swear by God, He grants them whatever they want and never makes them swear falsely. Bara ibn Malik is one of them.”  This man, the younger brother of Anas, lived a life of complete poverty at the barest level of subsistence, not having enough food or a place to sleep.
Although poor and ragged in appearance, such people were the most loved and appreciated for their sincere piety. They were praised, and their actions were esteemed in the Prophet’s assurance that they were among those whose promises God Himself keeps.
It is recorded that once when ‘Umar entered the Prophet’s room, he saw upon the Prophet’s back the marks of the rough matting upon which he had been sleeping. He began to cry, asking why the Byzantine and Persian emperors lived in such pomp and luxury while the Messenger slept on so rough a bed.
The Prophet replied: “Don’t you agree that they should have this world and we the Hereafter?”  Years later during his caliphate, when the treasuries of these two empires flowed into the Muslim treasury, ‘Umar continued to live a life of bare subsistence.
It is not poverty in itself that is good, but rather the state of mind that has disciplined (and triumphed over) the worldly self (nafs) and set its sight upon eternal life. Poverty may be a means to achieve that state of mind. But in some people it leads to inner distress, rancor, and ingratitude toward God, which is a root of unbelief.
Similarly, affluence and material security may delude certain people into pride and self-esteem, causing them to neglect the needs of others and their debt to God. Such arrogance and ingratitude also is a root of unbelief.
The surest way for believers to progress is to understand that whatever God gives is designed to perfect them. Regardless of personal circumstances, believers should strive to improve the welfare of others and trust inwardly and outwardly in the All-Mighty and All-Merciful.
The best attitude toward this world, which is only a resting place on the way to our everlasting destination, is expressed in this brief poem:
I accept, my Lord, whatever comes to me from You,
For whatever comes to me from You is my good;
Whether a robe of honor comes or a shroud,
Whether a sharp thorn or a sweet, fresh rose,
If it comes with Your blessing, it is my good that comes.
I hope this helps answer your question.
Salam and please keep in touch.
 Ibn Maja, Zuhd, 11.