Passive or hurt pets stay away from enemies- kill all the enemies and/or have a heart drop on the screen somewhere, and your pet will return- assuming it's Active via the whistle.