Kompany supports South Africa's decision to omit Foster for AFCON
Foster was initially included in South Africa's preliminary squad for the tournament despite Burnley informing them that he would be unable to travel.
He was eventually omitted from the final squad on Thursday. The Africa Cup of Nations kicks off in Ivory Coast on January 13th.
"It's a sensible decision from the South African FA, in terms of supporting the advice of experts," Kompany told reporters.
"We didn't have Lyle available for a month or more because we tried to put him first and part of his rehabilitation is being in a small environment.
"It's the travelling and everything else, the people who advised us throughout this period didn't think it was time yet for Lyle."
Foster was sidelined in November due to a recurring mental health issue before returning in December to play for Burnley in league games against Everton, Fulham and Liverpool.
South Africa manager Hugo Broos and Kompany had also discussed the player's mental health issues with medical staff before making the decision to exclude him from squad.
"Collectively we are doing something that is good for a South African human being, before we call him a player," Kompany added.
"We're taking care of him and looking after him. He'll be ready to perform for his country again at some point."