During Monday night's show, the "Cruel Intentions" actress said she "has to pull back" after getting results from several MRIs.
"I had these MRIs and the results came back and it all adds up to -- I can't, I can't go on with the competition," Blair told her dance partner, Sasha Farber, in a taped clip during rehearsals.
"My body is definitely taking a hit," she added. "It's way too much for the safety of my bones... so I could do extensive damage."
Blair, after the episode, said she put her "energy and heart" into dancing and said Farber was always there to hold her up.
"It's just such a sense of accomplishment to think I could do something that I dreamed of when I was little," she said.
Blair added that she was "so lucky" to have had the experience and "so sad" to leave the show.
Since 2018, Blair has battled multiple sclerosis, a chronic disorder in which cells from the immune system attack the central nervous system. In a 2021 documentary, "Introducing, Selma Blair," she spoke about her battle with the disease and how it has changed her life.
Prior to the premiere of "Dancing with the Stars," she said she was "feeling good" and ready to compete in the show, which is in its 31st season on Disney+.
"This is so powerful to me," Blair said about competing in the ballroom competition show.
"I am thrilled to learn how to move my body better right now, I am thrilled to have support, be here -- have camaraderie," she added. "I cannot believe that I am ready in my life to do this. I am so excited."
In her "Dancing with the Stars" debut, the actress delivered a powerful performance with Farber, when she stepped away from her cane and danced the Viennese waltz to David Cook's "The Time of My Life."
The performance left the ballroom in tears, including judge Carrie Ann Inaba, who told her that she danced like "a true artist."
"It burst my heart open," Blair told "Good Morning America" after making her "Dancing with the Stars" debut.
"It just felt so real and right once I could kind of settle into the music," she added. "It was just symbolic and let me step out of that comfort zone security into this one and have some fluidity in my movement."
Since the Viennese waltz, Blair has performed the jive to Elvis Presley's "Jailhouse Rock," the rumba to Sheena Easton's "For Your Eyes Only," which she danced blindfolded, and the quickstep to "The Muppet Show" theme song for Disney+ theme night.
In her final performance Monday night, she danced to "What the World Needs Now Is Love." The pair earned a perfect -- and symbolic -- 40 out of 40 for their last spin around the ballroom.
"To see the audience react to each and every one of us and our efforts, it's so heartening and I wish I could stay and learn," Blair said after her last performance. "I'm so proud of everyone and this audience for seeing us."
"I came into this competition late," she added. "I definitely was so excited to be active and learn... but it's tough on your body. I know as a mom and someone who wants to represent people, some people who are taking chances, sometimes there are consequences. Mine is fine, I'm gonna be OK, there are little tears, but I don't want it to be something serious."
"This competition showed me how much I love to be around people," she said before taking the dance floor a final time, with her son, Arthur, next to her. "How much I love to want to do something again."
"Dancing with the Stars" season 31 streams live on Mondays at 8 p.m. ET. on Disney+.
Disney is the parent company of ABC News and "Good Morning America."