There are some verses in the Quran according to which God's will has been introduced as the cause of dignity, misery, sustenance, forgiveness, punishment and reward of the servants. According to some other verses, guidance, glory, prosperity, sustenance and provision are earned through hard work and endeavor together with piety and sincerity. Not only are these two categories of verses not in contrast with each other but they confirm each other because divine will is unchangeable as per the requirement of divine wisdom and just rules. God's will means to act of one own choice and free will in accordance with God's wise and unchangeable tradition. Divine will in this meaning is not only consistent with justice but it is justice itself.
There are different verses that speak of the role of divine providence in the prosperity and misery, sustenance, forgiveness, reward and punishment of man. One of those verses is the verse under question. Meanwhile, there are other verses which attribute the principal role in attaining guidance, prosperity, provision and sustenance to hard work and endeavor along with piety and sincerity. They explicitly state that according to the law of creation, reason and sayings of the prophets, every individual is free in achieving prosperity, happiness, glory and misery and in his endeavor to acquire provision. As they say, Paradise is not given gratis. Then the question arises as to how all these are attributed to God? Is there any conflict between these two categories of verses? How should we reconcile between them?
Before dealing with the main question, we must say that the reason behind the emergence of such questions in the minds of some people is that they think that God's will is like theirs. They compare their own will with that of God whereas drawing such a comparison is basically invalid and baseless because man's will, likes and dislikes are derived from their personal whims and desires which in many cases do not have a logical and rational basis; rather in some cases their desires tend to be irrational and unreasonable.
However, divine will is unchangeable as required by divine wisdom and just rules because God created a series of causes for progress and success in this world. Benefitting from the effects of those causes is consistent with divine will. Hence, God's will means to act of one own choice and free will in accordance with God's wise and unchangeable tradition.
Having said that, the divine will in the above meaning is not only consistent with justice but it is very much the same as justice. That is because the reason that people ascribe prosperity, misery; guidance and misguidance; poverty and richness and sustenance of the servants to divine will is because God is the real source of creation, blessings and power which the individuals have. He is the One Who has placed every means at the disposal of His servants, means with which they may acquire happiness and prosperity. He has created such rules which, if disobeyed or violated by His servants, will lead to their misery and wretchedness. For this reason, both guidance and misguidance can be ascribed to him and this ascription is in no way in contrast with man's free will because man uses or misuse these rules, blessings and powers of his free will.[1] In view of the foregoing explanation, we will see into the verse under question once again.
God says in the said verses: "Whatever is in the heavens and whatever is in the earth is Allah's; and whether you manifest what is in your minds or hide it, Allah will call you to account according to it; then He will forgive whom He pleases and chastise whom He pleases, and Allah has power over all things."[2]
The clause "whom He pleases" in the verse and other verses signifies divine will which is combined with hikmah (wisdom). That is to say, God forgives and blesses whomsoever He considers worthy of receiving forgiveness and blessing. And He punishes whomsoever He considers to be entitled to punishment. That is because, divine will is not uncalculated; it is consistent with the merits. The All-Wise does not wish something without a reason; He does not do an unwise action.[3]
Therefore, not only are these two categories of verses not contradicting each other but they confirm each other because divine will means moving in accordance with the divine tradition and rules and in line with attaining the results which are an essential part of the causes.
For further information vide:
5049 (site: 5425), Index: The Compassionate God and Guidance of People
7849 (site: 7905), Index: Guidance of the Pious in the Quran.
[1] - Makarem Shirazi, Naser, Tafsir Nomunah, vol.2, pg.498 with little modification, Tafsir Namunah, Dar al-Kutub al-Islamiyah, Tehran, 1995, first edition.
[2] - Al-Baqarah: 283: "لِّلَّهِ مَا فىِ السَّمَاوَاتِ وَ مَا فىِ الْأَرْضِ وَ إِن تُبْدُواْ مَا فىِ أَنفُسِکُمْ أَوْ تُخْفُوهُ یُحَاسِبْکُم بِهِ اللَّهُ فَیَغْفِرُ لِمَن یَشَاءُ وَ یُعَذِّبُ مَن یَشَاءُ وَ اللَّهُ عَلىَ کُلِّ شىَْءٍ قَدِیرٌ."
[3] - Tafsir Namunah, vol.22, pg.92 (with partial modification).