Get the .deb file for debian stretch from here, then install it with:
sudo dpkg -i fail2ban*.deb
You’ll then need to fix the dependencies with:
sudo apt-get -f install
Next, there’s an extra dependency you’ll need, python3-systemd, so go ahead and install that:
sudo apt-get install python3-systemd
Finally, edit your /etc/fail2ban/jail.conf using your preferred editor telling it your preferred backend is systemd.
#backend = auto
backend = systemd
Last, but not least, start and enable fail2ban.
systemctl enable fail2ban
systemctl start fail2ban