"For to me, to live is Christ and to die is gain." What an awesome statement. How many of us can truthfully say that we believe that dying is gain? Not in the sense that we are suicidal, but just that we fully recognize the depth of the glory of heaven and the gain that we have by being there in constant communion with God. I think that most of us don't really recognize death as a gain, we are conditioned by our society, in spite of our Judeo-Christian heritage, to view death as something sad, and we are driven by our peers to obsess over earthly things rather than spiritual growth.
The really amazing thing is not that Paul made this statement while in prison. I think many people in prison would welcome the freedom of death. Especially if they were in a Roman prison; they would just be looking for some relief. The amazing thing is that Paul, fully recognizing the gain of heaven, also recognizes the job that is left for him to do here, but he doesn't see that job as something to hold to for personal gain.
Paul was one of the greatest heroes of the New Testament. A founder of churches and leader of the Christians. He could have chosen a life similar to that of a modern day televangelist. He could have had wealth, and followers, and people sitting around just looking for a reason to stroke his ego. Paul didn't want all of that, though, he only wanted to be with Christ, and he reluctantly accepted the fact that he needed to stay on earth to continue the work of Christ.
It's not that he didn't care for others and was selfish about wanting to go to heaven. He obviously cared a great deal about others. He just realized that as good as it was to be close to Christ on earth and doing the work of the ministry it was nothing compared to actually being in the presence of Christ.