There's no reference to this in the synoptic gospels. It's more of a doctrinal application of the religion which evolved long after the execution of the criminal Jesus.
Under Judaism the concept of heaven or hell is basically nonexistent, or is at least significantly different than is typically doctrinal for other Abrahamic belief systems. During the time of Jesus, many if not most sin required atonement. Covet your neighbor's wife and you would probably be struck by lightning, or your villiage might develop a spontaneous STD, or at the very least some other form of divine retribution was going to happen. So best to take care of that shit yourself through a series of penances performed commensurate with the sin committed. The local legal authorities under the theocracy in which you lived might also penance your sorry ass at the town whipping post, or you might get stoned just not in a good way. All of this was designed to cut down on things like raining frogs and locust swarms.
The concept of "Jesus died for your sins" didn't really come about until the hustler Paul needed to come up with some outside the box thinking for how to separate the richer, yet gentile Greeks and Romans from their wealth. Those folks were lining up with their coined filled purses for this Jesus craze, but unfortunately were still in possession of their hoodies which was a big no-no per mosaic law. The simplest solution was to send them down to the Rabbi for a turtlenectomy, but this was a pretty risky proposition in the days before penicillin. You stood a good chance of parts falling off at the least due to infection. The innovative solution was just to declare that "Jesus died for your foreskin", but the marketing department decided this was a hard sell. Better to be more inclusive as the whole coveting thing wasn't going over too well either.