Basically, the Air Conditioning packs provide the pressurization air.
It's a great system with a lot of redundancy. You'll note on the pressure controller that there is an "Auto" function of the knob, a "Standby" function and a "Manual" function which can be powered either by AC or DC power, so you can run it off generator or battery power.
To lose pressurization because of a total controller failure would be rare. It could happen but there are lots of options to control outflow.
Inflow is also redundant. There are two AC packs, although flight (with some restrictions) is allowed with one inop. They should not have gone to FL340 with one pack inop prior to T/O. Had a pack failed at FL340, they should have descended to FL250 max IIRC. It's been a while since I was in the books.
A/C Schematic If they were running with one pack already inop, there's two main lights there to watch.
One is the "Duct Overheat", especially if the pax were complaining of cold. You can dump in heat too rapidly and trip the pack due to a duct overheat. This is usually easy to reset, however, and it cools to reset temp pretty quickly.
The other two are related; the bleed trip and the pack trip. If you get a bleed trip, pack trip is almost simultaneous. You can get a pack trip without a bleed trip. Either of these can be difficult to reset or, in some cases, not resettable in flight.
Nonetheless, the Cabin Alt Horn is the key. Assuming they had two packs since they went to FL340, their cabin alt was probably around 7k in normal cruise. If they lost pressure slowly, the horn would have went off at 10k Cabin Alt, they should have donned the O2 masks and either controlled the cabin or initiated an Emergency Descent.
If they lost pressure suddenly or had a very high rate of climb in the cabin alt, they should have got the horn at 10K, donned masks and initiated an Emergency Descent. The Pax O2 masks would drop at Cabin Alt 14k. A 737 with gear and boards out should be able to get 5+K rate of descent without overspeeding, so figure about 4 minutes to get down to a "breathable" altitude. Shouldn't have been a problem. US airlines practice the ED in the sim at least once a year.
So A/C problems in and of themselves should not have caused this accident simply because there is a "Auot Fail/ Unscheduled Pressurization Change checklist and an Emergency Descent checklist procedures that should be very familiar to the pilots.
To see a representative 737 Pressurization and ED checklist put " 6-3 AUTO FAIL / UNSCHEDULED PRESSURIZATION CHANGE " into Google. It's PDF but won't come up unless you select HTML. Can't link to it anyway.