Dogs tend to arch their back for a brief moment when they are excited and want to play. This usually represents the beginning stage of them inviting you to play with them.
Arching their back is something that can also be pleasurable, and it does not mean that there is some problem. This way, they are stretching their muscles.
An inflamed prostate can lead to several problems for the dog, and it will give them a lot of discomfort. Arching their back helps them urinate and release some of that pain.