Beckham faces six months out with an Achilles injury, while Nesta could be back before season's end after knee surgery.
"It's never nice when the opponents hurt their colleagues, above all when they are great professionals and men who are admired for the work that they do every game and in every move," Totti said.
"David Beckham and Alessandro Nesta are among these people. They are two players whose worth isn't up for discussion but both have been recently injured."
Having suffered a serious injury before the 2006 World Cup, Totti had some advice for Beckham.
"They are difficult moments. You want to recover as soon as possible. You only want to wear your colours again, for the club and for the fans, and instead you must be patient.
"I want to send them my best wishes for a speedy recovery. I know very well what they will have to do to get back as soon as possible."