Only *IF* the iMac comes with a Fusion drive, then yes, you can replace the hard drive with an SSD (but if it came with just an SSD then there's no socket for the HDD), but the SSD part of the Fusion drive cannot be upgraded at the moment as no-one sells the PCIe SSDs Apple uses in its Macs and Apple doesn't offer an upgrade path.