“Leaving your backup drive plugged in has only a very small risk of malware damage, much smaller than the risk of forgetting to back up at all. Use good security tools, practice safe habits, and let backups run automatically. Some backup programs have additional features to protect your backups from malware, specifically ransomware.”
Go to Should You Leave Your Backup Drive Plugged In? The Real Risk for the description.