Based on the tutorial by Jeff Irwin published here: https://simplygoodwork.com/blog/how-to-add-a-mailchimp-subscribe-feature-to-an-existing-contact-form
The following code snippet can be placed in the Custom Javascript section in the Altruja Form settings.