Code red has more than one meaning, but all of its meanings refers to a critical situation. As for the army, according to the Urban Dictionary, code red is a military term used when "justice" is to be served in a unit. For example,
Soldier #1: Col. Jesep, did you order the code red? I want the truth.
Soldier #2: You can't handle the truth.
Source: Urban Dictionary: military code
In Rob Reiner's A Few Good Men, a court-martial drama about two US marines accused of murderinq one of their fellow-soldiers; the military prosecutor claims that the act was a deliberate murder, whereas the defense (composed of Tom Cruise and Demi Moore - how could they fail?) succeeds in proving that the defendants followed the so-called "Code Red," the unwritten rule of a military community which authorizes 'the clandestine night-time beating of a fellow-soidier who has broken the ethical standards of the Marines. Such a code condones an act of transgression, it is "illegal," yet at the same time it reaffirms the cohesion of the group. It has to remain under cover of the night, unacknowledged, unutterable - in public, everyone pretends to know nothing about it, or even actively denies its existence (and the climax of the film is, predictably, the outburst of rage of Jack Nicholson, the officer who ordered the night-time beating: his public explosion is, of course, the moment of his fall).