Some argue that God created the universe necessarily, but here I will make the argument that God must have created the universe freely. By freely, I mean that God had ability to do otherwise. To make this argument, I will be assuming that the universe is self-evidently contingent as the Five Ways of Aquinas or Leibniz’s Cosmological Argument demonstrate. The Bible itself seems to affirm that creation is a free act of God: “And he is not served by human hands, as if he needed anything. Rather, he himself gives everyone life and breath and everything else.” (Acts 17:25). Aquinas develops this point rather well:
Since, then, the divine goodness can be without other things, and, indeed, is in no way increased by other things, it is under no necessity to will other things from the fact of willing its own goodness. (Contra Gentiles, Ch 81, 2)
If God was compelled to create, it would be because there was something either in the nature of His own being or in the nature of creation itself that necessitated it. If it was the nature of creation itself that compelled God to create, then this could only be if the divine intellect grasped creation as necessary in itself and therefore something that the perfect will of God must create – otherwise His will would be imperfect for not willing what is necessary. But this obviously cannot be because the universe is contingent. The divine will cannot be necessitated to will what the divine intellect grasps as contingent.
The other option would affirm the contingency of the universe, but would argue that it is the nature of God that necessitates the creation of the universe. The justification here is that it is the nature of goodness to diffuse itself. However, this view implies that God’s nature would be deficient without the creation of the universe. Why must goodness diffuse itself in contingent ways? Goodness itself is by nature necessary and perfect. It would only need to diffuse itself if it is somehow imperfect. Perfection by definition needs nothing but itself. So contrary this view, it follows that God need not have created anything external to Himself.