Hi, and welcome !
When there is a verse I do not understand, the first thing I usually do is replacing it in its context.
Paul is imprisoned, he knows martyrdom is a probability, and yet he tells the Philippians to rejoice – because he, who had everything, threw it all away for Christ, and he is running the race for the prize prepared by God. Material circumstances do not matter any longer, living in abundance or poverty does not make a difference, only that prize does. This is why he can do all things (that is bear all things, like, in 3:10, knowing Christ, experience the power of his resurrection, and share in the sufferings of his passion by becoming similar to him in death).