The former army captain surged in the polls and became the frontrunner with 22 percent of the vote share, just after jailed former president Luiz Inacio Lula da Silva was barred from running.
Dr. Luiz Henrique Borsato, who performed emergency surgery on the candidate, said Bolsonaro's recovery so far was "satisfactory".
"He lost a lot of blood, arrived at the hospital with a pressure of 10/3, nearly dead.his condition now seems stabilised".
The alleged attacker is in custody and has been identified as Adelio Bispo de Oliveira, 40, who claimed he was sent by God to take the candidate's life, according to a police spokesman.
Amateur video footage of the attack shows Mr Bolsonaro being stabbed in the stomach earlier in the day while supporters carried him through the streets of Juiz de Fora, a city in the south-eastern state of Minas Gerais. The man was arrested in 2013 for another assault, police said. In the videos, Bolsonaro does not appear to be wearing a protective vest.
President Michel Temer quickly condemned the attack and instructed his minister of security to reinforce security for election candidates.
The attack is a dramatic twist in what is already Brazil's most unpredictable presidential election since the country's return to democracy three decades ago. Such measures are rare for candidates in Brazil.
Trump's actions 'detrimental' to country's health, says anonymous official
FILE - White House press secretary Sarah Sanders speaks during a press briefing at the White House, May 7, 2018. In an official written statement, the White House also attacked the opinion column and criticized its author.
Running as the law-and-order candidate, Bolsonaro has positioned himself as the anti-politician, though he has spent almost three decades in Congress.
The only Brazilian politician now more popular is the leftist ex-president Luiz Inacio Lula da Silva - who is in prison for corruption and has been banned from competing in October's election.
The other presidential candidates were also reportedly quick to denounce the attack.
Mr Bolsonaro has caused outrage among some in Brazil with a number of racist and homophobic comments; as well has his praise for the former 1964-1985 military dictatorship, which was responsible for widespread torture and human rights abuses.
The attack comes at a time of increasingly heated rhetoric, and sometimes violence, related to campaigns and candidates.
Also in March, Marielle Franco, a left-leaning black councilwoman in Rio de Janeiro, was shot to death along with her driver after attending an event on empowering black women.
Fernando Haddad, who is expected to take da Silva's place on the Workers' Party ticket, called the attack "absurd and regrettable". That puts Bolsonaro in the lead position, though it is unclear how the attack might affect the campaign for the October 7 presidential ballot.