First, let's broaden this question to mean "mass-driver" instead of "railgun" since a railgun might not be the best kind of mass driver for Mars. Mars is a dusty planet and the dust could interfere with the electrical contact between the armature and the rails.
To determine if the air on Mars is thin enough we can calculate the velocity we need to achieve at the exit of the mass driver with
Where 'G' is the gravitational constant,
'M' is the mass of Mars,
'r' is the distance from the center of Mars to the mass driver exit, and
'a' is the semimajor axis of the elliptical orbit you will be on after you launch.
'a' is also the average of the periareion (Mars equivalent of perigee) and apoareion (Mars equivalent of apogee) of your elliptical orbit.
So, for example, if you wanted to get to a 1000 km orbit and the mass driver's muzzle was at the top of Olympus Mons (21.229 km) then 'a' would be
$$(3389.5+1000+3389.5+21.229)/2 = 3900 km$$
and 'r' would be $$3389.5+21.229 = 3411 km$$
Mars's mass is 6.39E+23 kg and G is 6.67e-11 N⋅m2⋅kg−2. Plugging these numbers in you should arrive at a muzzle velocity of 3639 m/s. Add a little to account for atmospheric drag and subtract 242 m/s if you're taking advantage of Mars' rotation. Then you still need to do a circularization burn at the apoareion to get into a circular orbit. For this, you will need a rocket with a delta-v of 100.1 m/s.
Your drag will be
$$DynamicPressure = 0.5 * dragCoefficient * airDensity * v^2$$
If you make a very long pointy nose cone, the drag coefficient will be quite low - perhaps as little as 0.035 (see Figure 5.7 in this report).
Air density we can obtain from HopDavid's answer above. He estimated 0.0028kg/m3 for the top of Olympus Mons. So plugging these numbers in we get, roughly
$$DynamicPressure = 0.0028 * 0.035 * (3639-242)^2 = 1131 N/m^2$$
... which is not very much. A relatively small rocket could easily provide an offsetting force so that atmospheric drag wouldn't slow down the vehicle. For reference, a single RS-25 (Space Shuttle main engine) generates 2.279 MN of force, about 2000X the aerodynamic drag force per square meter.
Therefore, aerodynamically speaking, launching from the top of Olympus Mons with a mass driver is absolutely possible.
As the density of the atmosphere at the surface of Mars is 0.02 kg/m2, the dynamic pressure at the surface would be 8079 N/m^2; therefore, launching from the surface (technically called the Mars datum surface, or average surface elevation) is also possible.
Let's also consider the broader question of whether it makes sense compared to the alternative of using rockets.
The mass driver approach has the following advantages:
- Rockets would probably kick up a lot of dust on Mars, which might trigger additional cleanup costs such as having to clean off solar panels and windows around the launch site.
- Making rocket fuel, say methane and liquid oxygen, will consume a lot of energy, and energy is hard to generate on Mars. On Earth, oxygen and methane can be extracted from the air and oil wells and do not need to be synthesized. Pushing off the planet with a mass driver is significantly more energy efficient than manufacturing propellant and then using most of it to overcome the physics of the rocket equation.
However, a mass driver has the following disadvantages:
- It has a higher up-front cost to build. This would be especially true if most of its mass had to be shipped from Earth. If most of the parts can be manufactured on Mars this is less of a concern.
- A mass driver is less aim-able than a rocket. This might not be an issue if your goal is always to launch in roughly the same direction, for example, on a trajectory that will take you back to Earth.
- It might not be easy to set up a mass driver close to where you want to locate your settlement - at least not unless you are prepared to do a lot of tunneling and bridge building. Suitable locations for rocket launch pads will be easier to find.
A mass driver on Mars will make more sense once we have established a small colony on Mars. A powerful one could generate a lot of delta-v making it cheaper, faster, and more convenient for people to return from Mars to Earth. Having a fast-return option might be a deciding factor for people who are contemplating whether they want to visit and perhaps settle permanently on Mars. If you can grow your colony faster, that's worth a lot.
A mass driver on Mars might help humanity expand into the rest of the solar system since Mars is further out from the sun and its gravity well is smaller. It might one day be considered critical infrastructure for humanity's journey to the furthest reaches of the solar system and perhaps beyond.