Here's something I wrote here two years ago on the same subject:
Another use of railguns that I anticipate is anti-aircraft.
Modern aircraft can detect missiles a few different ways. If the missile is radar homing, it's easy, but even infrared homing missiles can be detected because of the rocket plume.
Imagine this, put an infrared or image tracking seeker and warhead on a rail-gun launched projectile and fire it. A current day fighter would be defenseless against it because it doesn't know it's being fired on. There's no plume warning, no smoke trail for the pilot to see, nada.
I'm betting this technology will also show up in main battle tanks. 30 years from now, I predict that the MBT of the US military will mount a railgun, will perform both anti-armor AND artillery roles, and each tank will be part of a battlefield network that uses distributed sensors to also perform anti-aircraft roles.
Imagine you have fifty of these tanks in a battlefield. Any that are at the front are guns down, taking out armor and defensive positions with direct fire. They can fire hundreds of shots because they're using inert railgun rounds that are tiny compared to modern projectiles (which are huge because they carry their propellent). Any tanks that are more then a few miles behind the current front can be both artillery to hit targets that are out of reach (eg, behind a mountain) of direct fire. All other tanks can be part of an autonomous 'No fly zone' enforcement that fire guided anti-aircraft munitions at targets flying anywhere from NOE to tens of thousands of feet up.
Since this is a pretty straightforward extrapolation based on current trends, I think this is another reason why manned aircraft will be exiting the battlefield of the future. Your standard $50 million fighter will be replaced by 100 $500K fighter drones. Instead of mega planes that dominate everything from angels 30, you'll have hundreds of NOE drones that will dart around, over, and under landscape features and fight it out at 30 feet. Anything else will be easy pickings for the integrated fighting net.