Princess Luna also known as the Queen of the Night. Her and Celestia rule as equals, although Celestia is the public face of the two being the oldest and first in line for the official title of “Queen”, not to mention she’s the far less intimidating of the royal sisters. Luna is a stern authoritative mare, although she has a rarely shown soft side, only shown to those shes closest to.
As a young mare, Luna spend most of her time training to become a princess, learning how to control her powers and such. Over time, Luna grew jealous of her sister Celestia, after she had worked so hard to learn how to raise the moon by herself, nopony made time to appreciate it. All of the princesses subjects seemed to only want to enjoy Celestia’s beautiful daytime, and hid inside their cottages throughout Luna’s wondrous night.
Over time Luna became angrier and angrier over the ignorance of her night, why didn't ponies want to enjoy her night as they did for Celestia’s day?? Eventually anger grew to become hatred and hatred eventually became evil, hence the Night Mare was born.
The Night Mare was an evil created by Luna’s hatred, it started out as just a shadow of emotion, before it managed to break into Luna’s conscious mind, filling her head with thoughts, terrible unthinkable thoughts. As time went on, the Night Mare gained power by feeding off of Luna’s hatred, until finally it could take it’s true form, using Luna’s body as a host.
Luna’s first transformation wasn't a full one, seeing that she was able to fight it. Eventually learning to control it for a while, before the Night Mare grew stronger, and forced Luna to transform against her will, forcing her physical transformation into Nightmare Moon. although it was Luna’s body acting as Nightmare Moon, she was still herself in her conscious mind, the Night Mare had taken control and Luna couldn't fight it any longer, she was so tired.
After a long battle, Celestia was forced to use the Elements of Harmony to banish Luna to the moon, leaving her trapped with the Night Mare for a thousand years. The Night Mare wreaked havoc on Luna mentally, giving her nightmares, and visions, and beating her down until she was practically powerless. Over time Luna learned how to fight back, although it was never enough to defeat the Night Mare.
Eventually the thousand years in the moon came to an end and Nightmare Moon was released to wreak havoc again, this time capturing Celestia as soon as she could to make sure she wouldn't end up in the moon again. This was when Nightmare Moon met six peculiar ponies, six ponies whom each of which represented the elements of harmony: Honesty, Kindness, Laughter, Generosity, Loyalty, and Magic. These six ponies managed to defeat Nightmare Moon with the Elements and the power of friendship itself, finally freeing Luna from the Night Mare’s prison.
Luna was extremely weak when she returned, barely able to stand on her own. Her body showed it, as her coat had been darkened and her mane no longer flowed with the power of alicorn magic, she had been badly scarred with the marks of Nightmare Moon, but she wasn't beyond repair. Celestia took it upon herself to nurse Luna back to health, and eventually she held a small re-coronation for her sister, to celebrate Luna’s return. At first Luna wasn't exactly sure how to act or really even function, seeing that she had spent the last thousand years living as just her own conscious without control of a physical body after she had lost such control the the Night Mare. Luna practically had to start all over, she didn't remember how to write, she barely knew how to take care of herself, and she could barely keep herself together.
After a few years Luna got better, and she became more of a royal presence, ruling along Celestia in an equal diarchy, with Celestia being the public face, and Luna working more with the royal military. Celestia tended to the diplomacy, trade, and general politics factors of the rulership, while Luna controlled the royal military forces, and served as a Sergeant to her soldiers. Luna also tended to the dreams of Equestria, keeping her subjects safe from the terrors of nightmares as she traveled through the dream realm every night. Each princess had their respective force to control as well, with Luna wielding the moon as Celestia wielded the sun.
After about 5 or so years of freedom from the moon, Luna reconnected with her old friend Starswirl, although he was no longer Starswirl but instead Discord Lord of Chaos. Before Luna was banished to the moon, hers and Celestia’s close friend and mentor went mad, after an experiment gone wrong. After Luna was freed from the moon, eventually Discord was reformed with the help of a certain young mare who went by the name of Fluttershy. Not long after Discord’s reformation, him and Princess Luna reconnected, become close friends once again.
One night while Luna was making her usual rounds through the dream realm, she came upon a rather distressed soul, and immediately went to the soul’d aid, only to find herself in Discord’s dream. Fighting with another version of himself, an evil half of himself perhaps. Luna recognized this situation, as it mirrored what she had gone through during her thousand years trapped inside the moon. Without a second thought Luna stepped in and fought alongside Discord’s evil half in his defense, she knew what it took to destroy the thoughts of evil and she couldn't bear to watch her friend suffer through the same pain as she had.
As Luna fought she could feel the evil getting weaker and weaker as she kept telling Discord to stop feeling guilty for the transformation he couldn't control, seeing that the evil was fueled by negative thoughts from its host.
Discord awoke the next morning and rushed to find Luna to thank her for finally ending his nightmares, after which Luna explained that she had gone through the same thing after transforming into Nightmare Moon. Over time the two became rather close and even formed a relationship, eventually getting married and having a child, one perfect son.
Luna couldn't help her sense of awe over the child, after she held him for the first time, it was like her life had gained this new sense of purpose. After spending so many long years trapped in the moon, Luna had to readjust to everything after a thousand years of imprisonment, but right in that moment she felt as if her life was coming back together and she had a real purpose again.
~~Some other notes:
~ Luna’s coat was at one point a lighter blue with few markings, before her transformation into Nightmare Moon. After Nightmare Moon’s defeat, Luna’s coat was darker and cold to the touch, and it stayed that way until she was nursed back to health.
~ because she had once caused so many deaths and destruction, the thought of being a mother and bringing something new and beautiful into the world was an abstract but wonderful thought for Luna, hence why she was so emotional after her son Day Dreamer’s birth.
~ for quite a few years after she had been brought back, Luna forced her own suffering with her creation of the Tantabus, the closest thing to the Night Mare she could make by herself. Until the Mane six convinced her that she didn't need to feel guilty anymore and she put the Tantabus to rest.