The problem you describe is almost certainly a flat battery.
The most likely thing is that the battery has got to the end of its life and needs to be replaced.
You can get it tested, this requires a tester which puts it under load, just measuring the voltage across the terminals doesn't tell you much.
When the ignition is on the car will use a certain amount of electrical power and if the battery is already low this can drain it enough that it won't start. It's not unusual, if the battery is only just too flat to turn the engine over that it can recover just enough in 10 minutes or so.
Starting is by far the biggest load on the battery in terms of current so it can easily be too flat to start the car but still be able to power lights etc.
If this only happens when the car has been on for a while then that strongly suggests that the battery is on the way out, typically a battery will last something like 5-7 years but it can be less if it is allowed to go completely flat eg if the car isn't started for several months.
It is also possible that if you mostly drive short distances the battery never gets fully charged so you could try charging the battery with a mains charger and see if that fixes the problem.
It could also be that there is a problem with the alternator or some other part of the charging system or that you have an electrical fault somewhere which is draining the battery more quickly than usual but if the problems only occurs after it has been left on for a while this is less likely.