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.
-- 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 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.
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.
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.
// 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