Raisman said in her book, “Fierce,” published Tuesday, that she partially tore left ankle ligaments warming up on floor exercise at a December 2015 national team camp.

Raisman thought about quitting gymnastics during that camp, not only for that injury but also because she was brought to tears — two days before getting hurt — believing that she wouldn’t make the Olympic team named in seven months.

Raisman was told by a doctor to keep pressure off the ankle for four weeks.

Later that month, she arrived at Ortiz’s house for a Christmas Eve small group gathering. Raisman and Ortiz had been friends since she threw a ceremonial first pitch at an August 2012 Red Sox game.

Ortiz asked how she was doing wearing that boot.

“I just don’t feel confident anymore,” she said. “There are all these younger girls coming up, and they’re all better than me.”

Ortiz, then a 40-year-old going into his final MLB season, nodded and offered advice.

“You have to use the moment and not let it use you,” he said.

Seven months later, Raisman made her second Olympic team. A month after that, she won another Olympic gold and two silvers, giving her six career Olympic medals.

Ortiz and Raisman have come to know each other in the last four years, after Raisman’s first Olympic appearance in London. Raisman, a native of Needham, Massachusetts, has attended a gala and golf tournament benefitting Ortiz’s children’s charity.

She previously threw a first pitch at Fenway following the 2012 London Games. It didn’t faze Raisman that her pitch Friday bounced before reaching home plate.

“My pitch was horrible, but that’s OK,” Raisman said on NESN. “I’m good at gymnastics, so it doesn’t matter.”

Raisman will rejoin her Final Five teammates for a USA Gymnastics tour of 36 cities that begins Sept. 15. Whether she returns to competitive gymnastics is unknown.