It is clear that Mars had a thicker atmosphere in the past, perhaps 3 bar or more. It is a near vacuum now (0.6 bar), so what has happened to Mars' atmosphere?
Gasses Absorbed Into Crust
-- When lightning happens in a nitrogen atmosphere, it can form nitrates. On Earth, biological activity absorbs these and returns the nitrogen to the atmosphere. If Mars lacked this, large nitrate deposits could build up in the soils. If this process occurred on Mars, they could form valuable biological resources to settlers.
-- Volcanic rocks eroding in a carbon dioxide rich atmosphere can form carbonates. These have been found in small quantities on Mars.
-- Ice has been found in Martian soil as permafrost, as ice caps at the poles, and as frosts.
-- It is likely that carbon dioxide will be found in water ice as clathrates.
-- Carbon dioxide has been spotted as ice at the Martian poles (especially the South Pole which gets colder than the North Pole). See Periareion. The South Pole may have buried CO2 which does not sublimate each year.
-- Cold clays can absorb carbon dioxide. If the planet warms, the CO2 would gradually out gas.
-- A recent paper has shown that a huge amount of water has been absorbed by rocks. On Earth, plate Tectonics takes these hydrated minerals and melts them, where water can return to the surface via vulcanism. On Mars the water remains in these minerals. 
Gasses Lost To Space By Mars' Low Gravity
Light gasses such as Hydrogen, Helium, & Neon, are lost on all terrestrial worlds. Small molecules move faster at a given temperature, and the fastest of these can exceed the escape velocity of the planet. Thus, smaller / warmer planets will lose these gases more quickly than larger / cooler ones. Gas giants have an escape velocity sufficient to hold on to hydrogen, which makes up a majority of their mass.
Water can be lost by ultraviolet light (UV) disassociating water into hydrogen and hydroxide. The hydrogen is then lost to space. This has happened on Mars and Venus, but Earth has been protected by is ozone layer forming a 'cold trap'. Basically, water vapour freezes into ice particles in the lower stratosphere, which prevents it from rising higher. At this level it is protected from the worst of the UV light by the Earth's oxygen atmosphere forming an ozone layer. Thus water loss on Earth has been very slow.
It is thought that a majority of Venus' water has been lost by this process.
Gasses Lost To Space By Solar Wind Sputtering
It is thought that atmosphere can be lost by solar wind 'sputtering'. If a planet lacks a magnetic field (see Magnetosphere) the solar wind can ionize gases in the upper atmosphere, and drag them away from the planet. This is a very slow process, but over billions of years, a significant amount of mass can be lost. A key point is that heavier molecules (such as carbon dioxide) which would normally be held by the planet's gravity can be lost from sputtering. It has been estimated that 1/3 of Mars' carbon dioxide has been lost this way. Nitrogen likewise is heavy enough to remain within Mars' gravity. But there is virtually no N2 in Mars' atmosphere. Sputtering would not account for the loss of all of this nitrogen, which suggests a significant amount will be found in the crust.
If humans were to terraform Mars to have a one bar atmosphere, it would last for a half billion years or so before sputtering would again reduce the air to a near vacuum.
Venus lacks a magnetic field, and experiences a solar wind more than 4.4 times greater than Mars', but it still has an atmosphere over 90 bar. Why Venus has lost so little atmosphere to sputtering is an open question.
Protection From Solar Wind Sputtering
Weak levels of paleomagnatism in areas of Mars' crust have been shown to reduce sputtering above these areas. This suggests that humans could build an artificial magnetosphere to slow this loss.
If we were to terraform Mars, this sputtering could be reduced by creating a superconducting ring around the planet's equator to make an artificial magnetosphere. Alternately a powerful magnet could be put at the SOL - Mars L1 point. (But the solar wind would push this magnet out of orbit so a significant mass would need to be spent station keeping.) Rather than doing either of these, it may be easier to just replenish Mars' atmosphere with an occasional icy asteroid from the Kuiper Belt.
A study by Marcus DuPont & Jeremiah W. Murphy published on 2021, April 08, in International Journal of Astrobiology, looked at if it would be better to build a magnet at the Sol-Mars L1 point, or make a loop around the planet. They found that the equatorial magnetic loop was more practical. 
This study gave the following bits of advice: To protect the Martian atmosphere a magnetic field of 1.25 microTeslas should be created. Counter intuitively, the mass needed to build big magnets is less than that needed to build smaller magnets (with much, much higher fields), so building a planet wide loop is cheaper than a tiny magnet at the L1 point. A magnet around Mars' equator should be a ribbon about 5 cm wide and with a total mass of about 5x10^15 kg (~5,000,000,000,000 tonnes). It would take ~1 Megawatt to keep it cooled to superconducting temperatures (minor compared to the cost of maintaining the current to fight the solar wind). The equipment would not fit on a spacecraft, it would have to be built out of local material. The cost would be astronomical with today's substances, hopefully improvements to superconductors (or carbon nano-tube superconductors) would lower the cost per square centimetre. Building up Mars' atmosphere from natural outgassing is too slow, importing volatiles or somehow forcing Mars' crust to release gases will be required.
// Discussion of atmospheric loss by sputtering.
// Discussion of how thick Mars' atmosphere used to be. See page 101.
// Discussion of how CO2 Clathrates could be part of Mars' subsurface ice. See page 199.
"Mars: A Warmer Wetter Planet", by Jeffrey S. Kargel, ISBN 1-85233-568-8
// Paleomagnetism and Sputtering.
// Introductory textbook on Planetology.
"Moons and Planets 5th Edition" by William K. Hartman, ISBN 0-534-49393-9
- https://science.sciencemag.org/content/early/2021/03/15/science.abc7717 - Long term drying of Mars by sequestration of Ocean-scale volumes of water in the crust
- https://www.cambridge.org/core/journals/international-journal-of-astrobiology/article/fundamental-physical-and-resource-requirements-for-a-martian-magnetic-shield/600798772F8D2C2898A8F3D4058204A6 - Fundamental physics make long thin loops better than small tight ones.