I heard the Messenger of Allah ﷺ say, "Allah recorded the measurements of all creation fifty thousand years before He created the heavens and the earth." He added, "And His Throne was upon the water."
سمعت رسول الله ﷺ يقول: كتب الله مقادير الخلائق قبل أن يخلق السماوات والأرض بخمسين ألف سنة، قال: وكان عرشه على الماء.
Muslim narrated it in the Book of Divine Decree (2653), from Abu Tahir Ahmad bin Amr bin Abdullah bin Amr bin Sarh, who said, "Ibn Wahb narrated to us, Abu Hani Khawlani informed me, from Abu Abdul-Rahman Hubli, from Abdullah bin Amr bin As," and he related it.His statement, "The first thing Allah created was the pen." What is meant by "first" here is the first command issued by Allah to the pen, "Write down the measures of all things until the Hour comes."