You cannot access the data if the APFS partition on the SSD is not mounted on your Mac. Thus, recovering data from the unmounted APFS drive is a priority and then you can repair the drive with First Aid, fsck command, safe mode, reformatting, etc.
APFS container won't mount possibly due to errors on the SSD such as file system damage, catalog file corruption, Disk Utility failures, system malfunctions, virus attack, and so forth. If it is the internal SSD on your Mac, you may find the AppleAPFSMedia not mounted or the Macintosh HD not mounted in Disk Utility.
Once you encounter the APFS not mounting issue on your Mac, you should recover data from the drive ASAP with the professional data recovery software - iBoysoft Data Recovery for Mac. You will need to reboot Mac into macOS recovery mode if it's a startup disk.