Federer, who won three of his 20 major titles in the past two years, has had incredible longevity in the sport with 21 seasons at the top level.
However, he has had to deal with his own share of injuries with back issues in 2013 and a freak knee injury in 2016 that led to surgery.
With Murray just 31, Federer hopes to continue to remain healthy to be able to leave on his own terms.
In fact, he said the perfect farewell may have already passed.
"If I wanted it that way, I could've maybe said it after the Australian Open [in 2017] when I beat Rafa [Rafael Nadal] in that epic final. I don't know if it's ever going to get better than that, because that was it for me."
He also told CNN he will not do a farewell tour with former coach and childhood idol Stefan Edberg advising against the move.
But the end is on his mind with Federer wondering whether he would like to go out in the place he's won eight Grand Slam titles.
"I have a lot of places that are very special to me, thankfully. I've been very fortunate. But yeah, sure, like a Wimbledon stands out as maybe a place, but there are actually also many others," said Federer.
"I've been thinking about it, like where is that place?
"But I think it will all come down to, is it the body, is it the family, is it the mind, is it one morning when I wake up, how does it happen?
"And then maybe that day that it happens, maybe that is the end, or maybe I say I can maybe get a few more tournaments left in me, I don't know."
In an interview with The Age, Federer said he was hit hard by Murray's retirement and seeing him "struggling."
''You want somebody to go there and feel like he's happy to retire," Federer said. "The problem is it's not his decision, it's the body's decision and that naturally hurts.''
Rafael Nadal also spoke about the end
Speaking at a news conference to talk about his health after three months out of competitive tennis and his prospects at the Australian Open, the only one of the four Grand Slam tournaments that he hasn't won at least twice.
After Murray's retirement, he only had one thing on his mind.
"Yeah, of course is very bad news," Nadal said. "Will be a very important loss for us, for the world of tennis, for the tour, for the fans, even for the rivals that he have been part of a great rivalry between the best players for a long time, and a great competitor.
"But being honest, when somebody like him, that he achieved almost everything in his tennis career, is suffering like he's doing for such a long time already, probably he does the right thing for his mental health."
Nadal has missed long periods of tennis because of injuries throughout his career, still managing to amass 17 major titles, but has never contemplated a date for retirement.
"I didn't arrive to that point. I am a positive guy. I always had the feeling that we'll fix it," he said. "But, of course, there is periods of time that you don't see the light. Is tough."
Federer has credited improvements in travel, in nutrition and in life balance for giving modern tennis players the ability to extend their careers well into their 30s.
He was 35 and coming off a long injury lay-off when he revived his career with an Australian Open title in 2017. He successfully defended the title last year, his 20th major.
Nadal's plan for longevity revolves around playing fewer tournaments and resting whenever he has persistent injuries.
That became less of an option for Murray, who is contemplating further surgery just to cut down on the pain he feels when he's doing such simple things as putting on his shoes and socks.
"Seems like he had not very long career because today players are playing that long. But he's 31 — 10 years ago, if he retired at 31, we will say he had a great and very long career," Nadal said. "We will miss him. But today is him. Tomorrow another one. We are not 20 anymore. Our generation, everyone is more than 30s."