El Capitan is a digital download (check the "Download macOS" section for instructions and the El Capitan link).
Download and install current or previous versions of the Mac operating system on compatible Mac computers.
support.apple.com
EDIT:
To get the OS on the new SSD there are many methods, but I will tell you how I would do it. My preferred method is more involved, but it has more flexibility for recovery if there is a problem.
1. Make clone of your current 10.8.5 to a external drive in case recovery is necessary.
2. Attach the new SSD externally. Format it Mac OS Extended (journaled) GUID Partition Map. Clone your internal 10.8.5 internal to the SSD. Boot from the external SSD (it will be slow since external is USB2, be patient). Check the things to see if everything seems to be on the SSD.
3. Install the SSD internally and boot up.
4. Download El Capitan and install it on the internal SSD.