God is working all these ages to create us into the image of God. Even though we are unholy and sinful unworthy to receive salvation or eternal life in heaven, since we are created into a holy people of God through the creation work of God, we can be the royal priesthood of God in heaven, reigning with God forever and ever.
Through the afflictions, God is refining us, which means we are made pure, clean, and beautiful that we can be called the heavenly citizen. Since we became unclean because of our sins, we are purified and refined through the afflictions on this earth.