In order to for a Mac to even detect an iPhone 7 when it's connected, a minimum Mac OS 10.10 (Yosemite) and iTunes 12.5 are required. Anything less, and iTunes will display an error of "An invalid response was received from the device," and nothing will happen. iTunes 12.5 comes with Mac OS 10.10 Yosemite, so that's really all you need.
For older machines, you'll need first to go to wikipedia.org and check to see whether your hardware is capable/ compatible with Mac OS 10.10 or not. You'll find a listing of Mac OS versions and information on which hardware will run on which. If your hardware will run Yosemite, then your next challenge is how to get it installed.
Since Mac OS 10.7, Apple stopped shipping physical media and released updates via the Apple App Store application. Problem is that they remove older versions of Mac OS installation media from the App Store. And, that is, the complete catalog is never available for customers to download- not even for legitimate, licensed customers. So, you'll need to either borrow or purchase a copy of the software media from a 3rd-party online reseller (Amazon, eBay etc.).
If you did manage to download the software at the time it was released from the Apple App Store, then you'll need to check its release date- specifically the year. And, you'll need to temporarily disable automatic time set and roll back the date/ time on your Mac to the same year as the release date of the software, and then install it. Otherwise the software will not install and will say it's corrupted or broken. Once the software is installed, then put your clock settings back to auto or the current date/ time- otherwise, you cannot download the latest updates from the App Store either.
Just my opinion, but I feel the above practice by Apple is extremely predatory and punishing for customers who really need to re-install, recover, or stay on a particular operating system slightly beyond the normal intended product cycle- for whatever reason. But, they don't seem to care much about serving customer needs anymore...