The question of Judith's parentage on The Walking Dead has been implied and joked about, but mainly unaddressed throughout the show. Many fans assumed that Shane was her biological father, not Rick, but there was no way to know for sure; paternity tests are not easy to come by in a post-apocalyptic zombie wasteland. And now, finally, Rick confirmed Judith is Shane's daughter on The Walking Dead, which put a lengthy mystery to rest. Though Lori assured Rick that the baby was his when she found out she was pregnant, it seems like that was just another bid to reaffirm their relationship.
It seems surprising for the show to bring this issue up so long after the fact, but Rick confessed the truth to Michonne to make a point about why he was conceding to Negan. He told her that he knew Judith wasn't his, but he loved her just the same and he had to accept the entire situation so that he could keep Judith alive. He connected that to what was going on with Negan; he had to make allowances and accept uncomfortable truths so that he could keep his people alive. Something that was a long-running fan joke is now a way of understanding Rick's motivations.
Accepting Judith's parentage is proof that Rick will do what he has to do to keep people alive, which is something he's struggled with throughout the show, but especially lately. Taking the proactive route to defeating the Saviors only resulted in the deaths of men Rick considered family and he cannot risk losing more family.
In an interview with Entertainment Weekly, Andrew Lincoln explained what drove Rick to finally voice the fact that Shane was Judith's father and what that meant. "It's a great, great secret that he's been holding on to for a long, long time," he said, adding:
It's also a very smart way of understanding why he's behaving in this way, because he's been behaving that way with regards to his child since the outbreak, since he got the news. There's a scene with Lori where it's almost touched upon — outside on the farm, there's a scene where he makes peace with whatever's gone down and that's, I think, a key moment.
Sharing the secret seemed to bridge the growing gap between Rick and Michonne, at least a little. She was having trouble understanding just why Rick was capitulating to Negan but getting that explanation assuaged things a bit. However, Michonne's resentment of the Saviors might outweigh her sympathy for what Rick is going through. Rick might be giving in so that he can get through mostly unscathed, but Michonne still has a lot of fight left.