You could, but it is likely to be a long wait, depending where you are. And depends also whether the hole is surrounded by porous gravel, say, then it will never fill up. While if it is a hole, say, in clay, it will fill up (and also get very muddy).
But if you are close to a stream and the stream rises in spate, it might fill up quickly.
Where I live, we have streams that drain the mountains, and because they have a big catchment area, and we get a lot of heavy rain, they can rise quickly. Normally just a quarter meter perhaps. But in very rare cases much more than that. But quarter of a meter difference could do it.
Like this but it’s a different place
Or even more dramatic
We had one spate a bit like that here. I slept right through it but others heard the river suddenly start to roar. And I woke up next day to see that a flood had been through the ground floor of the house I was in to some depth, a foot or so, and outside, the mark of dampness against the bridge showed that it had risen well over a meter in height against the bridge.
Sorry no scale there, but you can walk under that bridge with space to spare above your head. The water rose right up to where the arch starts in a fast spate here about a decade ago, Suddenly in the middle of the night. Next day it was gone, all that was left was wet marks and mud in the house. This is right by where I lived at the time, just the other side of that bridge in fact.. It was an unusual flood, the sort of one you’ll probably only get once in a lifetime here.
Similarly, if you are in a cave system, then after heavy rain, the caves can flood. Indeed speleologists can get drowned by suddenly rising water. So in that case it could take just an hour or so, even less. That is if there’s some water course - which may seem just a ditch, even dry, but then suddenly floods and fills the hole.
But now, suppose that it is a newly dug hole, lined with concrete, waterproof, like a swimming pool but not filled in yet, and nowhere near any stream, just on its own, nothing drains into it. In that case it depends on how much rain you get per day or per week etc.
So - now lets make things as easy for you as possible and suppose you are in India and it is monsoon time
And let’s put you in Cherrapunji, India on June 15-16, 1995. Then you can expect the world record for 48 hours of just under 2.5 meters. So you’ll get out of your hole / swimming pool in a couple of days, maybe sooner. Also since it’s India it’s going to be warm so you aren’t going to die of cold. World's Heaviest 48-Hour Rainfall Confirmed as More Than 98 Inches
That’s unusual but if you are in a hole there in July you can expect over 3 meters of rain a month, so depending of course on the depth of the hole, you won’t need to wait more than a couple of weeks or so.
Now if your hole catches the runoff from a street or a roof, it will fill much more quickly, perhaps in a day or two. E.g. to make the calculations easier, if it is a 3 meters deep, 1 meter wide square hole and there’s a 3 meters wide road next to it, and say 10 meters of that road drains into it, or a similarly sized area of yards or roofs drains into it, then it will fill in about a day, on average, in July in Cherrapunji.
However, if your hole drains into a stream or ditch then it might never fill up. And if you are in a hot climate it’s going to evaporate, probably as fast as it fills. If it’s in the Sahara desert, you’ll be there for centuries and if there is any rain it dries up, may get flowers blooming but if you are just in a hole in a random spot in the desert it’s not going to fill with water especially since it is just a hole in some sand.
But if you are in a wadi in a desert, then it will fill if you are lucky enough to be there just before the annual floods.
Though you’ll want to make a quick getaway once you are out of your hole in that case :)