
At this point we have the dead from all the ages of the earth being brought before God for the final judgement. Death and the grave give up their dead so that they can be judged on what they have done in their lives. The only people not attending this resurrection are the 'dead in Christ', the people who believed in God and Jesus who were 'caught up' at the rapture.
As to what they were doing before this we do not know. We are told that when we die time no longer exists so we can not say that they have been waiting in their graves for 1 or 2 thousand years because they are not constrained by time like us, to then it may have been minutes. The resurrection will not necessarily be one into their old body. Some religions do not allow cremation because of this but they forget that the body decomposes anyway. The resurrection is one of the soul the real person from the realms of the dead.