In general you won't need to get any codes unless for some reason you decide to completely wipe a device while away, or buy a replacement (which is not a good idea if you are mostly going to use it in your home country). Once a device is trusted it stays trusted unless it is reset. Still, with two trusted devices you would have to be in an unusual situation to then not be able to use either one. Maybe if you were standing at the North Pole and erased your phone there... ;-)
Also realize there are additional steps you can take to cover yourself. For example, make a friend or relative a trusted number so if you had to you could call them and get the code. Note that even if they have your code they won't have your password, unless they go the measure of pretending they were you forgetting your password, in which case they are maybe not somebody to trust in the first place.
To see, add, or change your trusted phone numbers use one of these methods:
● On your iPhone, iPad, or iPod touch: Go to Settings > your name > Password & Security. Next to Trusted Phone Number, tap Edit.
● On a Mac computer choose Apple menu > System Settings (or System Preferences), then click your name (or Apple ID). Click Password & Security, then add or remove a trusted phone number.
● Using a web browser:
1) Go to https://appleid.apple.com and sign in.
2) Follow security options until you find one letting you change trusted numbers,
3) Click "+" to add a new number (you may be required to verify this number).
4) If you wish to remove an old number, click "-" next to the number.
It’s a good idea to have multiple numbers available (ask a friend or a relative).
Related:
Set up an account recovery contact --> Set up an account recovery contact - Apple Support
- "An account recovery contact is someone who can verify your identity and help you regain access to your account and all of your data if you ever get locked out."
- You can select up to five recovery contacts for your account.
- Requires iOS 15 or iPad OS 15
- If you forget your Apple ID password or get locked out of your account, just follow the steps on your device to share the onscreen instructions with your recovery contact in-person or on the phone. Your recovery contact then shares a six-digit code that you enter on your device. After your identity is confirmed, you can reset your Apple ID password.
Help a friend or family member as their account recovery contact --> Help a friend or family member as their account recovery contact - Apple Support