I'm looking for a MacBook to develop iOS apps and I've found this mid 2009 17 inch MacBook Pro at a reasonable price.
Does Xcode 9 run on it?
Not officially, no.
Xcode 9 will require macOS Sierra 10.12.4 to run. Unfortunately, the Mid-2009 17" MacBook Pro can only run the latest version of OS X El Capitan 10.11.6.
However, unofficially the Mid-2009 17" MacBook Pro can run macOS Sierra by virtue of the macOS Sierra Patcher Tool.
If this is something you want to consider doing, make sure you read all the information on the macOS Sierra Patcher Tool page as it contains important information you should weigh up before proceeding. If it was me I would not proceed without a full backup ready so you could recover your system if all goes bad.
NOTE: I have not seen Xcode 9 actually installed on any unsupported Mac, so cannot confirm that it would work on one which has macOS Sierra installed as a result of the macOS Sierra Patcher Tool.
The laptop you are considering is a dual core i7 in all likelihood. This will not be a fun computer on which to run Xcode or El Capitan or Sierra (the last OS I'd run on a dual core MBP would be 10.8 Mountain Lion, Yosemite would perform particularly poorly).
For the difference in price you would be much better off to get one of the quad core i7 from early 2011 or last 2011. They aren't expensive now. Ideally you'd look for one with the weaker 6490 graphic card as the higher end Radeon 6750 burns out very frequently and leaves you with no graphics at all when it does. I speak from experience. I've had three Radeon 6750's burn out the motherboard on two MBP's over the year. Until this December the repair was covered by an Apple extended warranty. No longer.
You should run your 2011 MBP 15" or 17" (I have both and far prefer the 17") with only the built-in Intel 3000 graphics enabled. You can do this with free/donationware gfxCardStatus by Cody Krieger (I did donate as gfxCardStatus is lifeline for these computers and Apple never did as much for MBP users). This does mean no external monitors. If you want a dual monitor setup (for software development dual monitors is very helpful), you should buy any of the old MacPro's. There are easy ways to run even the most recent OS on them. The 2011 MBP's run much quieter with the discreet graphic card disabled.
Old MacBook Pro's are not for the faint of heart. One big plus with the 2011 and earlier MBP's is that unlike later models, one can disassemble and repair them relatively easily.