It should not ask for a password while backing up. If you have an encrypted backup it will ask for the encryption password when you RESTORE a backup.
You put a password on your backup, whether you remember doing so or not. Thatâs the only way encrypted backups get created. Either you checked Encrypt Backup, or, if you have a company email account on your phone, your Exchange administrator required it. But either way you were prompted to enter a password - twice. However, that could have been years ago; you are only prompted the first time you made an encrypted backup, you will never be prompted again until you go to restore a backup.
When you entered the backup password if you have a Mac and have Keychain enabled you were given the option of saving the password in Keychain (this is the default). So check Keychain for it.
If you havenât erased the phone yet you can create a new backup with a new passwordâ>About encrypted backups on your iPhone, iPad, or iPod touch - Apple Support
If neither of those work you get unlimited guesses, so try to guess what password you might have entered back when. If you are like most people it will be a password that you reused. And to speed up the process click to change the password and you will be prompted immediately.