As a Christian believer, I’ll have to answer this question from a non-Christian and somewhat scientific point of view. To try to answer the question from a theological perspective, for me, is impossible, because the Bible gave no clues as to what God was doing prior to creating the earth or the universe.
The bible tells us that “in the beginning” — of time that is, the spirit of God moved upon the face of deep. The earth was without form and void. In other words, something was already there, and God took control and brought it to another level. Could it be then, that, prior to that, God had been doing works in other parts of the universe?
In the beginning then, means “in the beginning of earth’s reality” and not necessarily “in the beginning of all there was an all there is to be.”
In the beginning, God spoke light into an already existing but dark and formless world. He gave it form, structure, light, laws, and ultimately, put life on it.
So what was God doing before that? While the bible limits earth’s existence to a particular time going backward, it doesn’t limit God’s existence. God simply existed, or exists, outside of space or time.
For the human mind, which is trained to measure space and time, this is ultimately impossible to comprehend. A structural world cannot simply be infinite. Maybe it can stretch infinitely forward, but thinking about it stretching infinitely backward exhausts the capacity of our limited mind. A God who talks, thinks, and move, must do those things within the confines of space and time. When God decided to form the earth, He must have had a thought, and before that a thought, and going backward. He created the earth on seven days and then rested. There must be something happening one, two, three. 1000 thoughts prior to the third day. And this in itself makes God, to our mind, relevant to time.
The bible doesn’t rule out that there could be something greater than God, who rules above the God of earth, and then something greater than that, etc. It doesn’t rule out that there could be other Gods who created other worlds or universes. What it tells us is about the God of the world we know.
The only way that the human mind can fathom the infinity of time is to think of it without space and matter. Think of a glass globe the size of a football field. The glass of this globe is so clean that you can’t see it. It is resting, perfectly round, in the middle of football field. There is nothing inside, no air, just a vacuum. If you didn’t walk down the stadium and rubbed your hand on it, you wouldn’t know it’s there.
Now imagine this glass sphere is the universe. You think nothing exists inside it because your eyes are not trained to see what it is made up. You have what is described as the absolute or untrained eye. But there is something inside the glass sphere that you can’t see. It is a thinking stuff. To your eye, invisible, but to the eye trained to see it, very visible.
This glass sphere just exists. Think of it as our universe. Inside of it, there is a myriad of activities. It is constantly forming stars, galaxies, planets, and living organisms, and constantly destroying them and then forming them again. For the untrained eye, no “time and space” exists in this glass sphere, but to the eye that is trained to see it, it does!
We can think of our universe in a similar way. Space and time only exists because our eyes and mind were trained to measure that. However, to the untrained eye, the entire universe is an empty, invisible sphere that simple is. No movement, no sound. No space, and nothing to measure those things. Just simple existence.