The UCMJ, or Uniform Code of Military Justice, describes crimes and the punishments for those crimes for individuals within the military. For the most part, it differs little from any State legal system as lying is bad, stealing is worse, and maiming and killing is worst. There are some crimes unique to the military. It is, for example, not only morally abhorrent, but illegal, in the military to commit adultery. Fraternization implies socializing between enlisted and officers in the casual sense, but within the UCMJ, it defines career ending romantic relationships between and officer and an enlisted member. Bouncing on either of these legal trampolines will land stiff penalties, often a court martial and prison sentence. Some of the emboldened deployed take the chance, and hence the genesis of the General Order 1b. I am not sure of the exact wording, but this edict essentially bans alcohol, porn, or visitation into the room of someone of the opposite sex in the deployed setting, and the penalty is steep. I guess if you don't go to the room of someone of the opposite sex, it is less comfortable to commit adultery or fraternize. The unattached, young virile population must adhere to the same rules, probably to limit war zone pregnancies and the spread of venereal disease. The army doesn't like venereal disease either, but this is only a USAF order, not DoD-wide. The army permits co-visitation, which makes things very confusing in a joint service base like this. You can imagine the scenarios the command has to adjudicate. In case you have a poor imagination, a USAF female was recently caught in an army uniform in efforts to take advantage of the more lax army co-visitation policy. This wasn't very smart: she violated GO1B, and she fraudulently misrepresented herself; double whammy.
Violations of GO1B are nearly always grounds for an Article 15, which is just shy of a court marshall, and can be a de facto career stopper for lifelong military. If violations also involve adultery or fraternization, a court martial is likely. Outside of this, or felonious acts which would otherwise lead you to prison in civilian life, it is hard to get into real trouble. I am not sure how the system was created, but unless you really fly off the handle and do something ridiculous, it usually take a long history of underperformance and several minor violations to lead to a letter of counseling. and several letters of counseling to lead to a letter of admonishment. Get a few of those in your file, and you may get a letter of reprimand, and that could lead to an Article 15. Mind you, underperformance without a serious of minor violations does not get punished. In fact, it usually leads to promotion - ascension by attrition.