This is one of those questions that has been asked for thousands of years and maybe it is one we are all meant to ponder on. However, here are a couple thoughts:
* The famous narration that "I [Allah] was a hidden treasure and I wished to be known, so I created the creation."
* Insofar as the attribute of the Creator (al-Khaliq) is one way of describing Allah, one might say that it is an innate tendency of Allah to create, just as a human artist often feels compelled to create. So, simply put, Allah creates because it is the divine nature to make things. Some people view creation as a perpetual matter; that is, every moment, Allah is re-creating creation, not just as something that happened once for the universe.
* Some people also say it is part of divine mercy to create sentient beings. Even though life can be difficult, we wouldn't even be able to say it is difficult if we weren't created with intellect and senses.
It is an excellent question to explore and I wish you the best in your pondering and research!
