Back in the dark ages we had IDE hard drives which required a completely different connector. Obviously they're not compatible, but neither would you want them to be.
Some older motherboards also do have limitations on the HDD size they can address. But your Z170 board won't have any issues there.
On the other hand, newer SSDs can come in mSATA, M.2 (Sata), M.2 (PCIe), U.2, Sata Express (never took off) or even in straight PCIe cards. Each of those require motherboard support or the correct adapters and BIOS support. So bear that in mind if you're high end SSD shopping.
But, for standard HDDs SATA has been around for ages and is backwards compatible with older SATA variants. So, assuming you're looking at a standard SATA HDD or SSD, there should be no compatibility issues whatsoever.