A pregnant 12-year-old has been forced to go through the Supreme Court for permission to have an abortion.

In a judgment published on Tuesday, the court ordered for the girl, known as Q, could go ahead with an abortion for her own mental and physical health.

The Supreme Court has given a pregnant teenager permission to have an abortion.

Justice Duncan McMeekin questioned the continued illegality of abortion in Queensland and agreed the child, who had previously self harmed, was mature enough to grant consent to the termination.

In a ruling made last Wednesday, Justice McMeekin allowed the abortion to go ahead.