The former Queen’s unique magic allows her to send her memories to her past self at the time when she believes she’s about to die. She also can send another person’s memories to their past self too. But in story it is assumed that she’s not sending to her past self in the current timeline but to her past self in an exact parallel timeline.
The story is elaborated by how the Queen chose her husband, how the royal succession war for the throne basically was a bloody one that nearly wiped out the royal family. How she had tried so many options in trying to survive as she pretty much dies in the other choices. And somehow through choosing her husband, the former King. Only she survived the royal succession war.
What they talk about together is that in the parallel alternate timeline. Souma wasn’t made king, but Prime Minister. Because nobles hated his reforms and how he cracked down on corruption, they pleaded with the king for him to stop and basically it boils down to Souma losing his position, and then later in that timeline, him and Liscia are assumed to have died during the rebellion of nobles and Amidonia invading. Several characters in that alternate timeline die. But it’s later revealed in that particular timeline, Souma and Liscia had survived and with the help of a certain ryuu character saved the Queen and King from the burning castle.
I could go into more details but this is from the LN.