The Walking Dead finally explains what Daryl and Michonne's "X" scars mean - including what happened and when - in season 9, episode 14, "Scars", which also takes place early on in the six-year time jump that transformed the series. After Andrew Lincoln's departure as Rick Grimes, The Walking Dead jumped forward six years, and in one of the first episodes, audiences noticed that Michonne had an "X" scar on the lower side of her back.
It was later revealed that Daryl also had an "X" scar in the same spot. This, coupled with the fact that Michonne and Alexandria have been hesitant to accept outsiders, meant that something bad happened in The Walking Dead's time jump. Given that Hilltop and Kingdom weren't as apprehensive, and that tensions between Hilltop and Kingdom aren't as strained as they are with Alexandria, it was deduced that whatever happened in The Walking Dead's time jump only occurred to Alexandria - and, more specifically, to Daryl and Michonne. And after all this time, we finally have some answers.
The Walking Dead episode "Scars" mostly takes place several months into the time jump, with Michonne pregnant. One day, a woman named Jocelyn and several kids are brought into Alexandria, and it turns out that Jocelyn is an old friend of Michonne's, from before the apocalypse. So, of course, they accept them in. But that was a mistake. When Judith and other Alexandrian kids were sleeping over at Jocelyn's place (and playing with her adopted kids), Jocelyn took them away in the middle of the night.
Upon discovering that Judith and the rest of the children from Alexandria had been taken, Michonne went out searching for them along with Daryl. They find them at an abandoned building and are quickly taken captive since they're reluctant to hurt children - and that's what ultimately led to them receiving their "X" scars. While captive, Jocelyn forced the children to brand Daryl and Michonne; it was part of Jocelyn's way to teach the children to adapt to the new, real world. The kids brand their targets and then hunt them (which itself doesn't make sense, considering the "X" branding is on the lower back).
Since only Daryl and Michonne were the only people to find the children, it seems they are the only ones who were branded, and eventually developed the "X" scars on their backs. It's unclear what the actual purpose was of the "X" scars and how it hardened Jocelyn's children, but at least The Walking Dead viewers now know where those "X" scars came from and from whom, which is why Michonne is so suspicious of outsiders, even people she knows personally.