On a theoretical level, service to country shouldn't have any sort of negative effect when a determination of child custody is being made. On a real level, that isn't always the way things work as anyone with experience in military family law in Mississippi will likely attest.
A parent who is also a service member faces the chance of being deployed. And it's generally accepted that deployments can be very disruptive to the wellbeing of any children in the family. Indeed, the effects of deployment on families are known to be such that current Pentagon policy is that it won't let a single parent enter the service. Becoming single after enlisting is another matter.
It must also be remembered that the foundation on which the court's decisions on custody are always supposed to be made is what is deemed to be in the child's best interest. All that being the case, it might be easy to appreciate why a court might view a military parent as a less-than-ideal primary custodian for a child.
To the extent that the legal system can accommodate the demands of a parent's military service, there are efforts made to do so. That's why many states require the courts to delay any family law actions, including child custody disputes, while a service person is deployed.
Family law matters are rarely simple. You can see from this brief outline of one issue that such issues often become more challenging if military service is a factor. Not only do the laws of a given state come into play, but so do federal laws and military regulations. That makes the help of an experienced attorney that much more important.
Source: FindLaw, "Military Child Custody: Key Legal Issues," accessed Nov. 6, 2015