Is it as simple as that, though? Paul was writing at the inspiration of the Holy Spirit, and as with all of Scripture, there is usually more to it than meets the eye! He probably did wonder if he was going to spend his last days in a Roman prison, but we must remember, first of all, to consume these words in the greater context of, not only his own writings, but the rest of Scripture!
The apostle Paul had inherited the Mind of Christ, which meant to serve others. He would rather be with his Lord, to leave his shackles & chains behind, and rest in the eternal comfort prepared for the People of God, but he realized that to remain in the flesh, though it meant the pain of prison, was more needful for them, in that they were under the persecution of both the Romans and the Judaizers! By remaining in the flesh, Paul would be able to minister more easily to those that faced this necessary persecution.
Another reason that Paul said what he said, when he said it, was that he & they, as Jesus Himself had, labored still under that old regime! Even though they were free of the shackles of that first ( covenant ) they had not yet entirely cast off the physical restrictions of their former wardens ( this is why Paul remained in the flesh )! There was still work for them ( and him ) to do before Jesus returned on the Clouds of Glory!
At the time of Paul's writing to the Philippians ( a Prison Epistle ), he did indeed expect ( and looked forward to the time ) that he would be with the Lord when he passed from this biological existence! As we have seen, this was the Jewish hope; this was also previous to the Parousia & the full implementation of the New Covenant in Christ! Because he had The Mind of Christ, then, Paul knew ( and was glad ) that he would be allowed to remain with them and ease their passage from the ministration of death, which still labored to breathe, to the ministration of Life!
Did the apostle Paul believe & teach an After-life? Most definitely! He expected, as Jesus had promised, that 'If anyone loves Me, he will keep My word; and My Father will love him, and We will come to him and make Our home with him' ( John 14:23 ) He knew that that their generation would 'see the Son of Man sitting at the right hand of the Power, and coming on the clouds of heaven' ( Matthew 26:64 )! He knew as well, that though they had already passed from 'death to life', they were not yet entirely free from their former prison!
As we ponder these things, our minds will try to lead us into useless wanderings & debates about whether or not we will be with the Lord when our biology perishes ( or whether we are with Him NOW ); whether or not the Scriptures speak of an 'after-life', and whether or not there is some 'place' called 'Heaven' where we will dwell with our Heavenly Father for Eternity ( once this transient life is over )! Such wanderings tend to make us so heavenly minded that we are of no earthly use! If we are to be of much use, we must realize that we ARE the benefactors of 'Life after Death'; let us Live while we are alive, then, and not worry about some ( possible? ) 'life after death': WE ARE LIVING IT!
Charles Haddon Shank