If you are using a VPN (Virtual Private Network) or your internet service provider dynamically changes your IP address, Facebook may think you are logging in from a different geographic location, triggering a code request.
If you are already logged into the Facebook app and need a code for another device: Tap the (three lines or your profile picture). Select Settings & privacy . facebook six digit code