He underwent surgery for injuries to his intestines and is expected to recover, hospital officials said.
The controversial politician, who has outraged many in Brazil with racist and homophobic comments, has performed strongly in recent polls.
Polls suggest he would get the most votes in next month's presidential elections if former President Lula da Silva fails in his attempt to overturn a ban on him standing.
How did the attack unfold?
Footage of the incident in the city of Juiz de Fora shows Mr Bolsonaro making a thumbs-up gesture and being held aloft by supporters when he is stabbed with what appears to be a knife.
He then doubles over with pain and his supporters quickly lower him to the ground and bundle him into a car.
After the attack, his son Flavio initially tweeted that the wound was "only superficial", but he gave a more sombre assessment two hours later.
"Unfortunately it was more serious than we had expected," he wrote. "He lost a lot of blood, arrived at the hospital with a (blood) pressure of 10/3, almost dead. His condition now seems stabilised. Pray, please!"
Hospital officials later said Mr Bolsonaro had suffered a "deep" and life-threatening stab wound in his intestines and was in a "serious but stable" condition.
Military police released a picture of the man suspected of stabbing Mr Bolsonaro
He was recuperating well in intensive care after two hours of surgery, they added, but would spend at least a week to 10 days in hospital.
Police said a suspect has been arrested and named him as Adelio Obispo de Oliveira, 40. Officials quoted by Reuters news agency said he appeared to be mentally disturbed.
He was manhandled and beaten by angry supporters of Mr Bolsonaro before being taken into custody.
What has been the reaction?
Mr Bolsonaro's electoral rivals have all condemned the stabbing. Fernando Haddad, who is expected to replace Lula da Silva on the Workers Party ticket, said the attack was "absurd and regrettable".
Speaking in the capital Brasilia, President Michel Temer said such an attack was "intolerable" in a democratic state and that he hoped Mr Bolsonaro recovered soon.
"Tolerance is a part of democracy. It is a part of the rule of law," he said.
The president's predecessor, Dilma Rousseff, warned that the attack cannot go unpunished "because it must serve as an example so that it doesn't happen to any other candidate".
Who is backing him?
Mr Bolsonaro's backers see him as a strong leader who would crack down on crime.
The 63-year-old, who is representing the Social Liberal Party (PSL), is followed by millions of Brazilians on social media, and many refer to him as the "Brazilian Trump".
He also supports loosening gun control laws, and is backed by millions of evangelical Christians for his uncompromising anti-abortion stand.
More about: Brazil