Who decides who can serve? Why can that person serve? Why can another person not serve?

Equality in the US Military

Gender: men/women/hermaphrodite/transgender/etc
Gender identity
Sexual orientation: same, opposite, asexual
Race/Religion/Ethnicity/Etc
Age
Treatment
1st amendment
14th amendment
Right to Privacy
Patriotism
Discrimination
Occupation w/in Military
Economic aspect
Societal aspect
Psychological aspect
Military spending/size
Private military vs Public Military
Other countries
Legal precedent
Draft: if it were to be reinstated
Who decides who can serve? Why can that person serve? Why can another person not serve?
A medical issue, such as previous heart transplant, is a given. This question pertains to gender/race/age/etc along those lines.
National security