Case and point was South Africa under apartheid.
Except for rugby( someone can confirm this), I believe all South Africa federations were banned from most international sporting events, because their respective federations could not abide by non-discrimination clause of non-whites.
So the international federations are not directly dealing the country's governments, but with their federations.

Pretty much, The Gleneagles Agreement. This was approved by the commonwealth, presidents and prime ministers agreed to it for their support against apartheid, to discourage contact and competition between their sportsmen and sporting organisations, teams and individuals from RSA.

Rugby being the predominant sport, due to the popularity of the game, popularity in the commonwealth, and RSA's success.