Those are generally stored on your provider’s servers, not on the phone itself (when you check voicemail, you’re actually making a phone call to their voicemail system). As long as you’re staying with the same carrier, your new phone will be able to access your old voice messages.