A 19-year-old rape survivor has been sentenced to 30 years in prison in El Salvador after she suffered a stillbirth due to complications during her pregnancy.

Evelyn Beatriz Hernandez Cruz was convicted of "aggravated homicide" on Wednesday under what Amnesty International called El Salvador's "retrograde anti-abortion law".

Local rights groups say Hernandez Cruz had been raped months before going into labour, but had not told police out of fear.

She also said she did not know she was pregnant when she suffered severe abdominal pain and fainted in her bathroom in April 2016.

Hospital staff reported her to officials and she was charged after the body of the feotus was found in a toilet.

According to local media, Hernandez Cruz was convicted on grounds that she did not get prenatal care. Prosecutors also argued that the baby may have died after birth.

El Salvador is one of five countries where abortion is criminalised in all cases.

Under the country's law, which was implemented in 1998, women can be charged for murder and other related charges even when a pregnancy is the result of rape, incest or when the life or health of the pregnant woman or girl is at risk.

A woman can be punished by up to eight years, and in some cases women have been given sentences of up to 40 years if a judge determines "homicide" was committed.

Politics in El Salvador are highly influenced by the Catholic Church.

"El Salvador's anti-abortion law is causing nothing but pain and suffering to countless women and girls and their families," Amnesty's Americas Director Erika Guevara-Rosas said in a statement on Thursday.

"It goes against human rights and it has no place in the country or anywhere."

Human Rights Watch has also called the law a risk to "women's life and health".

Evelyn was sentenced 30 yrs for an obstetric emergency today. This is Justice in #ElSalvador When will it end? #Las17 pic.twitter.com/AK4xLhfJkC — Kristen Thompson (@herequeer) 5 July 2017

According to the Citizens Group for the Decriminalisation of Abortion (CDFA), Hernandez Cruz's attorneys plan to appeal the ruling.

"Evelyn has been charged unfairly," defence attorney Dennis Munoz said, according to CDFA.

"It's a decision based on morality, not the law or justice."

Pressure mounts

El Salvador-based Alliance for Women's Health and Life documented at least 147 cases where women were charged with crimes under the abortion law between 2000 and 2014.

Among them was Maria Teresa Rivera, who was sentenced to 40 years in prison for "aggravated homicide" in 2011 after having a stillbirth in her bathroom. She did not know she was pregnant at the time.

She was released in 2016 after serving four-and-a-half years.

Pressure from women and rights groups has mounted across Latin America for governments to relax abortion laws.

READ MORE: Dying woman denied abortion in El Salvador

Earlier this year, a bill was introduced in the El Salvador that would change the law to allow abortion in some circumstances, such as rape or when a woman's health was a risk.

The proposed legislation remains in committee and there has been no decision as to whether it will be sent to parliament.

In May, a group of UN experts urged El Salvador to "allow the termination of pregnancy in specific circumstances".

"The criminalisation of the termination of pregnancy imposes an intolerable cost on the women, their families and the society," the experts said.

"It restricts women's access to sexual and reproductive health services and information," they added, saying El Salvador's law is in "contrary to international human rights standards and violates the country's international obligations".

A protest against the court's decision in Hernandez Cruz's case is expected later on Friday.