The public pressure on Anitta highlighted the polarization of these elections, the most splintered and divisive since Brazil’s return to democracy in the 1980s, and the role women may play in them.

Mr. Bolsonaro, a former army captain who has been a representative since 1991, was long a marginal figure in Congress, best known for his incendiary comments. Beyond denigrating women, he has also offended blacks and suggested he would rather a son die than turn out gay.

But a vast corruption investigation that engulfed all of the country’s major political parties and many traditional leaders has nevertheless propelled Mr. Bolsonaro to the forefront in this year’s race.

He is seen by his many supporters as a straight-talker who isn’t afraid to do — and say — what is needed. He has made fighting political corruption and rampant crime the cornerstones of his campaign, vowing to drain the swamp, give the police more freedom to kill criminals, and make it easier for civilians to own arms.

Mr. Bolsonaro was already leading the polls when his candidacy got an unexpected bump this month: He was stabbed in the abdomen at a campaign rally and rushed to the hospital with serious injuries.

According to the latest Datafolha survey, Mr. Bolsonaro has the support of 28 percent of those polled — in Brazil, voting is obligatory. His rivals are all below 20 percent.

Still, Mr. Bolsonaro does not appear to have the 50 percent needed to win outright on Oct. 7 and avoid a runoff vote. And if there is a runoff, standing among female voters could prove pivotal. According to a poll by Ibope, a full half said they would not cast their ballot for Mr. Bolsonaro under any circumstances, compared with 33 percent of men.