According to Entertainment Weekly, he chose to leave the show, but left the door open for a later return. Barba didn't die in Season 19, Episode 13, which aired February 7. Instead, Barba resigned after assisting with the death of a sick child. Peter Stone (Philip Winchester) is the new ADA.
Esparza joined SVU in Season 14 and became a series regular in Season 15. EW asked Esparza why he decided to leave now; here's his response:
"I've done six seasons, I felt like it was time to go. I had explored a lot of what I thought Barba was about. I just felt it was time to move on. I was also feeling like the role has changed over the years in a way that has been an interesting experience for me. Again, I'm a theater guy, so it's like having a script in front of you that keeps changing every time you go to do it. The learning process of how roles grow over a period of time with a series has been kind of fascinating, and I just felt I had reached the end of what I wanted to explore where they were writing."
EW mentioned that he was close with former showrunner Warren Leight, who left a few after Season 17. "Was that a factor in your decision to leave?" Here's his response:
"Yeah, I think that's pretty much understood. [Laughs]"
After his final episode (for now), Esparza tweeted love to star Mariska Hargitay, and also responded to Leight's sweet note:
I love writing for @RaulEEsparza -- no sentence, thought, cadence or scene beyond his ability. For years, my secret challenge was to try to write something he couldn't deliver. I never did. Le deseo toda clase de éxitos en sus esfuerzos.— Warren Leight (@warrenleightTV) February 8, 2018
Mariska Hargitay (Olivia Benson) shared her emotions at the exit of her costar:
One of the great honors of my life is to have shared the screen with the incredible scene partner, beautiful friend, giant heart, brilliant artist, kindest of men @RaulEEsparza. #SVU has been graced and great with you in it. Family always gets to come home... come home soon. pic.twitter.com/X5TUsdYzwI— Mariska Hargitay (@Mariska) February 8, 2018