Fighter jets are pressurized, just not AS pressurized as something more familiar, like a commercial jetliner.
For example, a commercial jet cruising at 35,000 ft would have (depending on the type) a cabin altitude of around 6-7,000 ft. The pressurization system holds the differential at 7.5-8.5 psid, once again with variations among airframes. This allows the aircraft to cruise at altitude while keeping the cabin livable, and specifically below 10,000 ft.
Fighters typically use a lower psid, so that at 35,000 ft the cabin altitude might be 13,000 ft or so. The goal of a pressurized fighter cockpit is to avoid most of the unpleasantness associated with exposure to high pressure altitudes - internal gas expansion, the bends, etc. A lower psid can achieve this and also allow the designers to have some “leakage” during high-performance maneuvers without any ill effects.
As for the wearing of the mask, most of what you see in the movies is exactly what you guessed: Hollywood nonsense so you can recognize who is flying. However, guys do sometimes fly without their masks. Anytime the cabin altitude is below 10,000 ft you can drop your mask with no worries - and sometimes you just have to get at that itch! If you’re cruising at anything under 29,000 feet or so, you could fly all day with your mask off. And “off” doesn’t always mean “off” like in the movies. Just unclicking those bayonets a couple of notches can make life much more bearable, even though you don’t have a good “seal”.
Most training sorties in fighters last under two hours, and usually the mask never comes off the entire time. On longer missions (like what they’re doing over Iraq right now), most people will drop the mask for a while, especially on a 6-hour mission.
The mask provides oxygen constantly, and is critical in case something goes wrong. It can be a problem with the pressurization system, or in extreme cases if the airplane is damaged at altitude and depressurizes. It also provides protection for the face in case of a birdstrike, debris entering the cockpit and during ejection.