Allah Subhanohu wa T'ala says in the Holy Quran:

وَهُوَ الَّذِي خَلَقَ السَّمَاوَاتِ وَالأَرْضَ بِالْحَقِّ وَيَوْمَ يَقُولُ كُن فَيَكُونُ قَوْلُهُ الْحَقُّ وَلَهُ الْمُلْكُ يَوْمَ يُنفَخُ فِي الصُّوَرِ عَالِمُ الْغَيْبِ وَالشَّهَادَةِ وَهُوَ الْحَكِيمُ الْخَبِيرُ

 

(6:73) And He it is Who has created the heavens and the earth in truth; and the very day He will say: "Be!" (resurrection) there will be. His word is the Truth and His will be the dominion on the day when the-Trumpet is blown. He knows all that lies beyond the reach of human perception as well as all that is visible to man; He is the All-Wise, the All-Aware.'
It has been asserted again and again in the Qur'an that God created the heavens and the earth 'in truth'. This covers a wide range of meanings:
First, that the heavens and the earth have not been created just for the fun of it. This existence is not a theatrical play. This world is not a child's toy with which to amuse oneself as long as one wishes before crushing it to bits and throwing it away. Creation is rather an act of great seriousness. A great objective motivates it, and a wise purpose underlies it. Hence, after the lapse of a certain stage it is necessary for the Creator to take full account of the work that has been done and to use those results as the basis for the next stage. This is stated at various places in the Qur'an in the following manner:
Our Lord, You did not create this in vain (Surah Al 'Imran 3:191).
And We did not create the heavens and the earth and whatever lies in between them playfully (Surah Al-Anbiya' 21:16).
And did you think that We created you out of play and that you will not be brought back to Us? (Surah al-Mu'minun 23:115).
Second, it means that God has created this entire system of the universe on solid foundations of truth. The whole of the universe is based on justice, wisdom and truth. Hence, there is no scope in thesystem for falsehood to take root and prosper. The phenomenon of the prosperity of falsehood which we observe, is to be ascribed to the will of God, Who grants the followers of falsehood the opportunity, if they so wish, to expend their efforts in promoting unrighteousness, injustice and untruth. In the end, however, the earth wfll throw up all the seeds of untruth that have been sown, and in the final reckoning every follower of falsehood will see that the efforts he devoted to cultivating and watering this pernicious tree have all gone to waste.
Third, it means that God has founded the universe on the basis of right, and it is on the ground of being its Creator that He governs it. His command in the universe is supreme since He alone has the right to govern it, the universe being nothing but His creation. If anyone else's commands seem to be carried out in this world, this should not cause any misunderstanding. For in reality the will of no one prevails, and cannot prevail in the universe, for no one has any right to enforce his will.
The verse stresses that when the veil which keeps things covered during the present phase of existence is lifted and the Truth becomes fully manifest, it will become quite clear that all those who seemed or were considered to possess power and authority are absolutely powerless, and that the true dominion belongs to the One True God Who created the universe. (Tafheemul Quran)