You can get an error like this when switching to a new provider with the same phone.
In this specific case, the user switched from Verizon to T-Mobile.
After switching you may need to update the settings for the Network Mode.
If, after going through these steps, the phone still won’t update then the phone is most likely locked by the old provider.
At that point, you would have to contact the original provider to see if they can unlock it.
On the phone go to Settings > More networks > Mobile networks > Network mode > LTE/GSM/UMTS > Automatic
Then select “Network operators”
For more help on this issue, check out this article where they discuss the issue further:
https://forums.androidcentral.com/samsung-galaxy-s5/502616-just-changed-tmobile-sim-card-not-verizon-message.html