The Sanhedrin was the Supreme Court of Israel and they also decided matters of religious law. If they made a mistaken ruling on a matter involving the penalty of kareis (spiritual excision) and the people acted upon this ruling, the Sanhedrin had to bring a sacrifice of a bull to atone for their mistake.
The reason for this offering is obvious: if the Sanhedrin were able to err in so important a matter, there had to be something lacking in them to warrant the truth being withheld. They were therefore to offer this sacrifice as a means to improve themselves and to tighten up their spiritual links to God so that they might do better the next time. Recharging their spiritual batteries would fill them with the zeal to be more diligent in their work.
The obligation to bring this sacrifice was upon the judges of the court, not upon the people who relied on them for a proper ruling. The people had to have acted on the court’s ruling in good faith; if the people knew the ruling was erroneous and chose to act intentionally, the Sanhedrin was not liable for the error. There are a number of other details that affect when this sacrifice applies, outlined in the first chapter of tractate Horayos. If the conditions for the Sanhedrin’s offering were not met, then a person who acted on the ruling would bring a sin offering.
This obligation applied to the Sanhedrin in Temple times. It is discussed in the first chapter of the Talmudic tractate of Horayos, starting with the first word on the first page (which is 2a). It is codified in the Mishneh Torah in the twelfth chapter of Hilchos Shegagos. It is #68 of the 248 positive mitzvos in the Rambam’s Sefer HaMitzvos.