Sara Walsh recently revealed that she was fired from ESPN shortly before she was set to return from maternity leave. On Sunday — Mother’s Day — she shared a deeply personal story on social media saying that some time ago, she suffered a miscarriage live on the air while hosting an episode of “SportsCenter” at the University of Alabama.

“The juxtaposition of college kids going nuts behind our set, while I was losing a baby on it, was surreal,” Walsh, who said she was three months pregnant at the time, wrote on her Instagram account. “I was scared, nobody knew I was pregnant, so I did the show while having a miscarriage.”

She accompanied a lengthy post with a photo of her twins, who were born in January after “two more failed pregnancies” she said she endured after her on-air ordeal. She noted that, in the photo, her babies were wearing onesies with the phrase “Good egg,” which she described as “poignant.”

Walsh, who turned 39 in April, said that her twins were the product of an IVF (in vitro fertilization) procedure, but that she had been hesitant to use the harvested eggs because she “couldn’t bear the idea of all hope being gone.” Even after being confirmed as pregnant, she went to lengths to conceal her condition on ESPN and made no public baby announcement for fear of another miscarriage.

“For as long as I can remember I hosted Sportscenter on Mother’s Day, and the last couple years doing that have been personally brutal,” Walsh said. “An hours-long reminder of everything that had gone wrong.”

Now Walsh’s babies, born to her and husband, minor league baseball pitcher Matt Buschmann, are buoying her during a trying time. She was among ESPN’s huge round of layoffs, in which many well-known personalities were fired, and at the time, she indicated that she was surprised by the news.

Walsh told The Post that she had moved her family from Florida, where she had chosen to give birth while near her family, back to Connecticut, where ESPN is located, in April, only to be told the next day that she had been fired.

“I was truly excited to return to work today from maternity leave with the twins,” Walsh said on social media this month. “Unfortunately, I will not be coming back as I was included in the recent layoffs. Much appreciation to those I worked with, and especially those who watched.”

In her Mother’s Day message, Walsh wrote, “I wasn’t on TV today, and I’m not sure when I will be again, but instead I got to hang with these two good eggs. My ONLY good eggs. And I know how lucky I really am.”