In the time of Job (roughly 1500-2000 BC), people didn’t have the same kinds of theology we do now. The concept of an afterlife was not defined. They didn’t really know about Heaven.
Yet Job says “As for me, I know that my Redeemer lives, and at the last He will take His stand on the earth. Even after my skin is destroyed, yet from my flesh I shall see God.” (Job 19:25-26, NASB)
He himself has stated earlier that when we die, we die, and all lie together in the ground. Yet, in the middle of deep anguish, he speaks out a truth for the ages: after he dies and rots away, in his flesh he will see God.
How could he say that? How could he say it with conviction when “officially”, he doesn’t know about it?
There’s only one way: he had a relationship with God that was so good, he just understood it! He had a personal relationship with God.
This is what happens when we are saved: we become friends with God. Servants still, yes, but also friends. And Job knew this, even though he didn’t really know it.