If 2 ships of the same type are in the battle, such as two ISD 2s, one empire, one NR, for example, capturing the empire's ISD will cause your NR ISD to become an enemy ship for some reason. To avoid this, if you intend to capture say an ISD2 from an enemy faction, do not bring in an ISD2 and it will be ok. Encountered it before many times.