The charges against the girl were brought against her last year after police investigated accusations that her stepfather had raped her and killed their baby. He is still to face trial.
Prosecutors said her conviction did not relate to the rape case.
Amnesty International condemned the punishment as "cruel, degrading and inhumane".
The government said it did not agree with the punishment and that it would look into changing the law.
Zaima Nasheed, a spokesperson for the juvenile court, said the girl was also ordered to remain under house arrest at a children's home for eight months.
She defended the punishment, saying the girl had willingly committed an act outside of the law.
Officials said she would receive the punishment when she turns 18, unless she requested it earlier.