There is plenty of oxygen on Mars, just not in the nice O2 form that we need to breathe. Getting that requires some effort but will be worth it: oxygen is not the sort of thing we want to have to haul with us from Earth, particularly not for long-term colonization. The buzzphrase applied to technology that uses existing resources is In Situ Resource Utilization (ISRU), and this is what we are going to do, in one form or another.
The atmosphere of Mars is 96% CO2. We can’t breathe that but if we can get at the oxygen locked in that formula, we are good to go. There are a number of different ways to go about this.
One utilizes a process known as the Sabatier reaction. This reaction is exothermic (produces heat) and spontaneous in the presence of a catalyst. It requires hydrogen as an additional input and produces methane and water (CO2 + 4H2 -> CH4 + 2H2O). The H2O is then broken apart via electrolysis (2H2O -> 2H2 + O2). The resulting O2 is stored and the resulting H2 is recycled back into the reaction. One benefit of this method is that the CH4 can be used as rocket fuel. One problem is the need for hydrogen, which is not yet available on Mars in large quantities and would have to be brought from Earth. I say “yet” because there is plenty of hydrogen on Mars in the form of water (H2O); we just don’t know how to get at it yet. Later colonization methods will be able to use it, but that’s a topic for another piece. Exploration and early colonization missions will have to bring their own.
The Sabatier-electrolysis reaction sequence can be combined with another process called the reverse water-gas shift reaction (RWGS) in order to produce a greater proportion of O2. By combining the H2 liberated in the former with more CO2 in the presence of a catalyst, carbon monoxide and water are produced (CO2 + H2 -> CO + H2O). The water can again be broken down by electrolysis. This reaction is endothermic (requires heat) but will occur within the heat range produced by the exothermic Sabatier reaction. So the one can power the other. In fact, the combination of Sabatier-RWGS is the starting point for a number of interesting processes to produce useful compounds ranging from propellants to plastics. Because of this, some form of this reaction sequence will be used by Mars colonists in the future.
Another approach to oxygen production is called solid oxide electrolysis. This process separates oxygen without need of hydrogen by heating the CO2 to a high temperature (800°C) then electrochemically reducing it to CO and O2 and collecting the O2 (2CO2 -> 2CO + O2). Technology for accomplishing this has been developed and a small scale test version of this will be included on the Mars 2020 Rover. The device is called MOXIE (a cheeky acronym for Mars OXygen In situ resource utilization Experiment). One problem with this method is that the heating and electrolysis require power. This is not a roadblock, but it would be nice to increase the efficiency.
Which brings us to a recently proposed idea that uses plasma technology to dissociate the oxygen from the carbon. This approach is currently only theoretical but could be more efficient in the conditions present on Mars than the process used by MOXIE.
This has been a rather technical post and it barely scratches the surface of the sort of chemistry shenanigans that will be necessary for Mars exploration and colonization. Links are below for more detail. The bottom line is that we can make oxygen, as well as other useful stuff, from the atmosphere of Mars.
https://mars.nasa.gov/mars2020/mission/instruments/moxie/for-scientists/
https://en.wikipedia.org/wiki/Sabatier_reaction
https://marspedia.org/Reverse_Water-Gas_Shift_Reaction
https://phys.org/news/2017-10-mission-mars-oxygen-plasma-technology.html
http://iopscience.iop.org/article/10.1088/1361-6595/aa8dcc/pdf