Introductory History of the Litany of Loreto
The Litany of the Blessed Virgin--also called the Litany of Loreto--is
one of the many Marian litanies, or praises of Mary, composed during
the Middle Ages. The place of honor it now holds, in the life of the
Church, is due its faithful use at the shrine of the Holy House at
Loreto, which, according to tradition, was the small cottage-like home
where the Holy Family had lived and which was miraculously transported
by angels, in 1291, from the Holy Land to its present location in
Loreto. It was definitely recommended by Pope Clement VII and approved
by Sixtus V in 1587, and all other Marian litanies were suppressed, at
least for public use. - Source: The History of the Litany of
Loreto.
One meaning of the Marian Title Mirror of Justice is found in the Presentation Our Lady of Guadalupe: Mirror of Justice given July 31, 2010 by His Eminence Raymond Leo Cardinal Burke, D.D., J.C.D. at Queen of the Americas Guild Annual Meeting, Shrine of Our Lady of Guadalupe, La Crosse, Wisconsin.
The Blessed Virgin Mary, Mirror of Justice
The Blessed Virgin Mary, Mother of the Church, teaches her children
obedience to the Church’s discipline. [...]
One of the titles by which we address Our Blessed Mother in the Litany
of Loreto is Mirror of Justice, Speculum Iustitiae. Simply put,
the title reminds us that we see in Mary the image of how to live in
obedience to God’s law and so grow in the likeness of Christ, that is,
grow in the pure and selfless love of God and of our neighbor. It
should not surprise us that, when the faithful have a strong devotion
to the Blessed Virgin Mary, they are also strong in their obedience to
Christ and to those who act in His person as Head and Shepherd of the
flock in every time and place, namely, the Holy Father and the Bishops
in communion with him, together with the priests, their co-workers. -
Source: Obedience to the Magisterium and the Responsibility of Bishop toward the Laity | Cardinal Burke | Marian Catechist
Apostolate.
History of the Symbol of Mary Mirror of Justice (Speculum justitiaé)
This article Litany of Loreto | campus.udayton.edu says
Its origin [of the Litany] is believed to be a medieval rimed litany (see Paris
manuscript Nat. lat. 5267, fol., 80r) influenced by Eastern Marian
devotion, in particular by the famous Hymnos Akathistos. Contrasting
with the older Litany of All Saints, the Loreto Litanies are purely
ad- or invocational litanies. As can be observed, for example, in the
so called Officia Mariana, many more Marian litanies were and are in
use but destined for private devotion.
This mentions when the litany originated and under what influence.
The article continues to explain the structure of the litany and under 4. Symbols of Mary it says:
We then have thirteen symbolic advocations, mostly taken from the Old
Testament and applied to Mary which highlight her virtues and her
eminent role in salvation history:
(1) Mirror of Justice (Speculum justitiaé)
[...]
Elsewhere on the website it explains the meaning

Speculum Justitiae
Mirror of Justice
The various symbolic meanings of the mirror highlight: (1) purity of
the soul, (2) self-knowledge and moral integrity, as well as (3) its
ability to reflect reality. Mary's soul is holy and pure. She
reflects the Sun of Justice, meaning God's perfection and holiness.
She is the mirror without blemish of God's majesty (Wisdom 7:26).
The Sun of Justice is reflected in the image of Mother and Child. The
angel with balance and sword, usually a symbol of justice, signifies
God's perfection. There is a second and oval mirror whose surface is
tainted and marred. In it, three shadowy silhouettes can be barely
perceived, featuring Adam or sinful humanity between Good and Evil,
that is Satan, beckoning and tempting, and the guardian angel watching
over his protégé. This mirror does not reflect light and perfection
but darkness and sin, or at least the blurred human vision of God and
eternity.
Thus Paul reminds us that "at present we see indistinctly as in a
mirror, but then face to face" (1 Corinthians 13:12).
Further Reading: Litany of Loreto | New Advent and Mirror of Justice | salvemariaregina.info.
Please listen also to: Audio from Advent recollection with Father Austin Dominic Litke, OP.