If you see someone wearing a different color than their teammates during a team sport, there’s a good chance it’s the goalkeeper. Soccer and ice hockey goalies, for example, always wear jerseys that don’t match the team uniforms; and water polo goalies wear red caps to set them apart.
For indoor volleyball, on the other hand, there is no goalie—but there’s still a player on each team whose jersey clashes with everyone else’s. As PopSugar reports, that’s a defensive specialist called a “libero.” It’s a relatively new position, launched internationally in 1998 to encourage longer, more elaborate rallies (a rally is everything that happens between the serve and the end of a play). As the Fédération Internationale de Volleyball (FIVB) explains in its rule book [PDF], “The introduction of a specialist defensive player—the Libero—has moved the game forward in terms of rally length and multi-phase play.”
This is because liberos aren’t just adept defenders. They’re also some of the best passers on the court, which makes them instrumental in setting up offensive plays. That said, there are several actions they’re not allowed to take: serving, blocking, spiking, or any other attack hit that occurs when “the ball is entirely higher than the top of the net.” And while liberos can play any spot in the back row, they—unlike the rest of their teammates—never rotate to the front row. Basically, liberos are responsible for helping the offense, but they can’t actually partake in the offense themselves.
Since volleyball involves so much rotating, and there’s no limit on the number of times liberos can be substituted in and out of the game (called “replacements” because they don’t contribute to the team’s overall substitution count), it would be difficult for referees to keep track of them if they dressed like their teammates. And considering all the moves that liberos can’t do, it’s especially important for refs to be able to spot them without having to memorize their names, numbers, and/or faces. So the FIVB rule book mandates that liberos wear “a different dominant color from any color of the rest of the team.”
In short, liberos wear contrasting colors for the same reason goalkeepers do: They have a different job and different rules than the other players, so it’s easier for everyone if they stand out from the rest.