Uric acid is the by-product of the metabolic processes of the cells in the body. In other words, it's a waste product from their processing of nutrients and oxygen to sustain life. And when cells undergo catabolism ,i.e., start to die, they generate even more uric acid. The cells dispose of the uric acid into the blood stream, which carries it throughout the body. About 2/3 of it is processed by the kidneys to be excreted in the urine, and the other 1/3 is broken down by the action of naturally occurring intestinal bacteria.
Uric acid is carried through the blood as a supersaturated solution, which means it can be precipitated from solution in the form of solid crystals of monosodium urate (MSU) when something happens to trigger that event. The trigger for such an event can be that the cells start to generate uric acid at a rate faster than the kidneys can dispose of, or the kidney activity slows down so that it can't dispose of it fast enough, or the blood becomes too acidic for other reasons. When MSU crystals form, they are usually deposited in connective tissues in the body, which is present in joints, in the ear lobe, and many other places. The reaction of the body's immune system to MSU through chemical sensing of its presence is to initiate defense mechanisms because it interprets the MSU as an indication of excess uric acid in the blood which may be caused by dying cells, which the immune system attempts to prevent from spreading. The immune system's chemical response to MSU in a joint leads to the intense pain of gout. The fact that MSU crystals have a needle-like shape has nothing to do with the pain they cause. It is all chemistry.
Hypoxia (lack of sufficient oxygen in the body) is an event which can lead to the precipitation of MSU by two effects. First, it leads to cell catabolism, so that they generate excess uric acid. Second, it makes the blood more acidic, so that MSU is more likely to precipitate. One medical journal publication reports that hypoxia caused by moving to a much higher elevation results in a notably higher incidence of gout. Another very common cause of hypoxia is sleep apnea - the repeated cessation of breathing during sleep for many seconds at a time. That's how sleep apnea can be a very immediate cause of a gout attack. Unfortunately, the vast majority of people who undergo sleep apnea have never been diagnosed with it, and don't know that they have it. Even more unfortunate is that most doctors don't pay enough attention to the possibility of sleep apnea in their patients, and don't know enough to screen their gout patients for it. My primary care physician has been doing that screening for several years, and has found that a very high percentage of his gout patients have sleep apnea that was previously undiagnosed. Anyone with gout should be screened for sleep apnea. Untreated sleep apnea can lead to many other serious, even life-threatening, conditions, as well as continued gout attacks.