The air conditioning system on board airliners is an open system: it scoops up air from the atmosphere, compresses it, expels it through the cabin vents, and then outflows it through discharge valves. In modern airliners there is a certain amount of re-circulation: the expelled air was of such good quality that it seemed a waste to just dump it in the atmosphere.
In the A320 family of airliners:
- Outside air is compressed in the engine compressors, part of it is tapped of as bleed air: already compressed and warmed, it is used for refreshing the cabin air (marked green).
- Temperature and pressure regulators then provide automatic mixture control for the amount of outflow: the outflow valve is regulated, decreasing the opening results in increase of cabin pressure and decrease of flow.
- The recirculation fans regulate how much air is re-used, after being filtered through HEPA filters which remove pathogens and other nasty stuff.
The whole cabin air volume is refreshed every 2 - 3 minutes, as also referenced in this answer: with such a frequent refresh rate, it would be pretty safe to assume that there will always be roughly the percentage of oxygen in the cabin as there is in the outside atmosphere (see below for the actual percentage!) . People have climbed to the summit of Mount Everest without the help of oxygen masks, and that summit is about at cruising altitude of an airliner. AFAIK, the aircon system does not have oxygen sensors, but it does have temperature and pressure sensors which are of more immediate concern.
Low concentration toxic gases are much more dangerous than a drop in oxygen concentration. In fact, the human body makes use of this: when holding your breath, the urge of breathing fresh air again after a while comes from the increase in CO$_2$ in the body, not from any decrease in oxygen. So CO$_2$ detectors on board of aircraft would make sense, as would detectors for the very lethal carbon monoxide. These are available, even in the form of a key hanger for GA pilots (not including any links due to them being adverts).
There have been reports of dizziness and fainting on board of airliners, and investigations into these. A sample of various flights did not reveal a particularly high carbon dioxide content:
With additional measurement reports pending, I found in-flight cabin air quality measurements of oxygen to be relatively stable, ranging from 11.2% to 12.5%.
Typical outdoor CO2 levels are between 350-400 ppm (0.035% - 0.04%) or up to 500 ppm by some sources.
Carbon dioxide levels measured in-flight in the aircraft cabin ranged between 0.04% or 400 ppm and 0.1% or 1000 ppm to date in our studies and were measured at close to 0.5% or 5,000 ppm in earlier studies.
As indicated at CO2 HEALTH EFFECTS, occupants are unlikely to be affected or to notice CO2 levels under 2% or 20,000 ppm - a far higher number than in-flight aircraft cabin carbon dioxide levels.
Notice that the oxygen contents on board is a bit over half of that of the outside air - the cause of dizzy passengers? Reports of dizziness do keep appearing, and nothing beats direct detection of noxious gases by a sensor. Problem is, there are so many of them. Oxygen, carbon monoxide and carbon dioxide sensors would be good candidates for inclusion into the aircon systems.
On your second part of the question
Is there any situation (emergency or not) in which some other gas could pressurize the cabin and lower the O2 percentage inside it?
Yes, in air conditioning systems that use bleed air there definitely is, an engine malfunction can for instance inject gases from burning oil into the cabin air, a problem that was reported a few times for the BAE 146. From this report:
The British Aerospace BAe 146 was the aircraft type most commonly involved in fumes/smoke events when taking into account flying activity. The Airbus A380, Boeing 767, Embraer EMB-120 and E-190 were among other aircraft types that also had a higher than average rate of fumes/smoke occurrences over the period.
The most common source of fumes/smoke was aircraft systems issues, primarily relating to failure or malfunction of electrical and auxiliary power unit (APU) systems. Equipment and furnishings also featured highly as a source of fumes and smoke. Within this category, air conditioning and galley equipment were the most common sources of fumes/smoke. External sources of fumes/smoke and cargo/baggage related events were relatively rare.