The recreated VM instance got assigned a new external IP and caused other issues(e.g. couldn't connect to remote servers because the new IP was not being whitelisted...)
Why would the instance group manager recreate a VM instance? Is there any way to prevent this recreation?
As DazWilkin explain from your configuration, this behavior is by design and working as intended. Managed Instance Groups (MIGs) are treated as clones and, unhealthy clones are terminated and replaced (by creating another clone). You can address the allocation of IPs but if this overall behavior is undesired, you may need to rethink you're use of MIGs.
Additionally, there is a Feature request regarding if you Create Instance Group based upon a template and assign Static External IP to each instance,if instance got recreate on instance-group then the static IP address should remain assigned to the instance.