Yes, absolutely. ZFS snapshots are immutable, such that once a snapshot is created nothing can change it (until to destroy the snapshot). Not designed to help with ransomware, but is a perfect use case they'd protect against. (You also want backups, of course).
Edit: I guess I'm assuming the ransomware doesn't have access to the raw disks, which would be true if you were using a NAS (e.g. FreeNAS) and connecting to it via NFS, CIFS, etc.