the concept of a railgun is that the slug, a mass of iron or something magnetic, is propelled by magnetic forces created by the connection of the slug and the rails (yes, the actual electric connection between the slug and rails causes movement..) The slug is merely a bunch of metal propelled down the rails..
er, did i mention its just a hunk of metal? It doesnt 'hit' anything.
However, a actively magnetic slug of some sort (say, a flare by a counter-sniper) shot nearby the hostile slug will shift the hostile slug off its trajectory a few degrees (see a pattern here?), and would be enough to make it a missed shot.