According to the report, her parents had insisted that the girl, 13, not take part in swimming lessons at her school in Frankfurt.
- Australia lawmakers vote down burqa ban
- France burqa ban comes into force
- Gaza female students required to wear Muslim garb
Some Muslim parents say that such lessons run contrary to Islamic principles of modesty.
However, the judge in the case said the girl could wear an all-over swimming garment sometimes dubbed a "burkini" in order to accommodate her beliefs.
Some Muslim girls already wear the garment to take part in lessons.
However, the BBC said, others reject that solution, saying that the garment is clumsy but also that it is unacceptable for Muslim girls to be in close proximity to boys clad only in swimming trunks.
The judges in Germany's Federal Administrative Court ruled that "the basic right to religious freedom does not... provide for any demand not to be confronted at school with the behavioral habits of third parties - including those pertaining to clothing."
The judges went on to point out that such "habits" were widespread in Germany in the summer months.
The lawyer for the girl's family had said that there was already segregation of gym lessons in some Catholic areas.
There are also some secular gyms in Germany which have special segregated areas reserved for women to exercise, the BBC said.
German magazine Der Spiegel reported that the family who brought the case in question are from Morocco, adding that the girl had done well academically since joining the school.
- Receive Ynetnews updates
directly to your desktop