I don't think it is set in law, for the army. But with any public jobs, there are rough quotas that have to be respected otherwise people get pissed.
The parliament is actually made up of 64 christians and 64 muslims by law. The government has to represent all sects and is by convention half and half. The president is maronite christian, the prime minister sunni muslim, the head of the parliament shia muslim. The head of the army is maronite christian, and so is the head of the central bank, I believe. Etc, etc...
It's a very shitty system because it greatly reinforces sectarianism. There are arguments that it is a stabilizing force, but then there are times where it doesn't and all breaks loose.
Anyway, enough of that threadjack.
To say something about the thread topic, there are no openly gay people in the Lebanese Army, since it's still a taboo issue. Homosexuality is not a crime, but homosexual acts are. However there is definitely a thriving underground gay scene.
And the Icelandic army doesn't have any gay members in it. That's because there is no Icelandic army