Provided the iPhones are both registered under the same Apple ID.
In the past my iPhone, my wife’s iPhone and my iPad and her iPad were all under my Apple ID and all four of them were backed up to my iMac.
If your two iPhones are registered to different Apple IDs, then the only way to back the one with a different Apple ID from yours, would require a third party app such as iMazing. This what I use now for my wife’s devices now that she has her own Apple ID.
iMazing lets you transfer music, files, messages, apps and more from any iPhone, iPad, or iPod to a computer, Mac or PC. Manage and backup your iOS device simply without iTunes. (was DiskAid)
A backup allows you to copy and save the information from your iPhone, iPad, or iPod touch. If you replace your device, you can use a backup to transfer your information to a new device.
Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.