The "Little House on the Prairie" star, who was running as a Democrat for Michigan's 8th Congressional District, told People she's "devastated" that her doctors advised her to withdraw from the race.
"My doctors said there's no way for me to continue to deal with the incredibly rigorous demands of a congressional campaign without continuing to do harm to my body," she told the magazine.
Gilbert, 52, said she needs surgery for two herniated discs in her spine due to two head and neck injuries she sustained in 2012.
Gilbert, who had spinal surgery in 2003 to fuse another herniated disc, said the nerve damage from her 2012 injuries has become unbearable.
"I have numbness in my right hand, shooting pains in my right arm and numbness in my neck," she said. "So, after years of care, my neurologists are sending me to a neurosurgeon because I need to have another spinal surgery."
"It's indescribable to have to make this decision, because I had my sights set on my opponent and a lot of people around me felt that I could win," Gilbert said about dropping out of the race.
But she isn't ruling out a future run.