From what I've heard, there's always a random chance of Shadow leaving after any battle in the overworld. However, this didn't seem to be true when I was playing through the game months ago (although that was the GBA version, who knows?).
--
Currently Playing - Mega Man 2
Hopefully Next Up - Final Fantasy VII, Metal Gear Solid, Brood War