The idea of followers of Jesus getting to join him in heaven upon dying probably didn't take shape until about a half-century after Jesus died. To be sure, Jesus's followers believed from early on that the faithful would be admitted to the "Kingdom of Heaven," as the New Testament calls it. But "Kingdom of Heaven" is just Matthew's synonym for what an earlier Gospel, Mark, had called the "Kingdom of God." And this kingdom was going to exist on Earth, when God righted history's many wrongs by establishing an enduringly just rule.
The Gospel of Luke, written around 80 or 90 CE, half a century after the crucifixion, offers the New Testament's earliest clear expectation of a rewarding afterlife upon death. Luke says that the godfearing criminal hanging on the cross next to Christ will find himself in "paradise" alongside Christ that very day. Luke also tells a story about the afterlives of a rich man and a poor man. The rich man, who died without repenting his sins, goes to a part of the underworld where, he observes, "I am in agony in these flames." The poor man has better luck. He finds himself in the company of Abraham—perhaps, as some have argued, in heaven, but, at the very least, in a more hospitable part of the underworld: someplace where "he is comforted".
Some scholars contend that this idea of immediate reward for the Christian dead goes back to Christ himself—who, after all, is the one who in Luke makes these two references to the afterlife. Yet neither reference is found in the earliest gospel, Mark, or in the earlier-than-Luke "Q source" (the hypothesized source of stories shared by Luke and Matthew).
What caused this shift in expectations by the time Luke was written? For one thing, as the decades rolled by and the supposedly imminent Kingdom of God failed to materialize, there was growing concern among Jesus's followers over the state of the not-yet-resurrected dead. The Apostle Paul, writing around two decades after Jesus's death, had reassured followers that recently departed family and friends of believers would join "the rest of us" in the Kingdom once the Kingdom came. But by the time of Luke, more than a decade after Paul's death, hopes for the Kingdom's near-term arrival had dimmed.
Now the attentive Christian was concerned not just about whether dead friends and relatives would eventually be resurrected but about what death would feel like until resurrection—since it increasingly looked as if the Christian in question would join his or her friends and relatives in that state before Judgment Day.
Had Christian doctrine not evolved in response to this challenge, it would have lost credibility as the Kingdom of God failed to show up on Earth—as generations and generations of Christians were seen to have died without getting their reward. So the Kingdom of God had to be relocated from Earth to heaven, where generations of Christians had presumably gotten their reward—and you could, too, if you accepted Christ as your savior.
Why is it Luke, not the roughly contemporary Matthew, who makes this pivot? Maybe because Luke is a more "gentile" gospel. Whereas Matthew often seems to be trying to convert devout Jews to the Jesus movement, stressing its compatibility with traditional Judaism, Luke is focused on winning "pagan" converts. And if he is going to compete with pagan religions, he'd better make sure that Christianity can match their most popular features.
And one of those features was a blissful afterlife. Though the official gods of the Roman state offered no such thing, the empire had been besieged by foreign cults that, by filling this void, had won followings. These religions of salvation came under a variety of brands. Persian cults talked of souls migrating through the planetary spheres to paradise, and Greek cults offered bliss in Hades, the Greek underworld that had once offered only a humdrum existence for the average soul but now featured lush subdivisions. Many rivals of Christianity seem to have been thriving in part by offering eternal bliss.
Am I saying that Luke stole his afterlife scenario from a competing religion? Not with great confidence, no. But if you wanted to indict him on this charge, you would not be wholly lacking in evidence. The evidence would focus on the Egyptian God Osiris. Osiris bears a certain resemblance to Jesus as Christians would later come to conceive him; Osiris inhabited the afterworld and judged the recently deceased, granting eternal life to those who believed in him and lived by his code. But Osiris was doing this a long time before Jesus was born, and meanwhile he had migrated to the Roman Empire, where he had developed a following.
Certainly that story in Luke about the rich man and the poor man in Hades has Osirian overtones. At the time Luke was writing, a written copy of an Egyptian story about the afterlife was circulating in the Roman Empire. It was about a rich man and a poor man who die and go to the underworld. Both are judged at the court of Osiris.
The rich man's bad deeds outweighed his good, and so he was consigned to one of the less desirable stations. (Specifically, the story explains: the "pivot of the door" to the underworld is "planted in his right eye and rotating on this eye whenever the door is closed or opened." Understandably, his "mouth was open in great lamentation.") In contrast, the poor man, whose good deeds outweighed his bad, got to spend eternity in the company of the "venerable souls," near the seat of Osiris. Plus, he got the rich man's clothes: "raiment of royal linen". (The rich man in Luke's story wore "purple and fine linen".) The moral of the story, "He who is good upon earth they are good to him in Amenti (the underworld), while he that is evil they are evil to him."
Luke's story about the rich man and the poor man seems to have no precedent in earlier Jewish or Christian tradition. So there is indeed a chance that Luke heard or read the Egyptian story and adapted it for Christian use. But we'll probably never know, and anyway, that isn't the point. The point is that, whether or not Luke borrowed this particular story from Egypt's heritage, this theme—immediate reward in the afterlife—must have come from somewhere, and the likely source is one of the religions with which Christianity competed in the Roman Empire.