The Mac App Store link for OS X Yosemite (10.10.5). The Mac App Store link for OS X El Capitan (10.11.6). The first one will likely not be available in most countries, because Apple seems to want upgraders at least on 10.11 these days.

The Mac running 10.10 could re-download the Yosemite installer from the Purchased tab in the Mac App Store, if logged in to the App Store with the same Apple ID as was used originally to get Yosemite. Download, and copy the installer to the other Mac, and run it there.

OS X 10.11 is the “maximum” OS version for the 2008 iMacs.
I can’t advise on the speed or memory. The system requirements for El Capitan are the same for Yosemite (and Mavericks, for that matter).