The law passed in 2011, months after Republican Gov. Scott Walker took office. Thousands of protesters converged on Madison while the bill was before the state legislature, and Democratic lawmakers left the state in an unsuccessful attempt to prevent a vote.
The justices ruled 5-2 that the law does not restrict union members' constitutional right to freedom of association.
"No matter the limitations or 'burdens' a legislative enactment places on the collective bargaining process, collective bargaining remains a creation of legislative grace and not constitutional obligation," Justice Michael Gableman said. "The First Amendment cannot be used as a vehicle to expand the parameters of a benefit that it does not itself protect."
The court reversed a decision by Dane County Circuit Judge Juan Colas in 2012 that key parts of the law are unconstitutional. The law has already been upheld by a federal appeals court.
Walker survived a recall election in 2012. Recent polls have shown him locked in a close race with Democrat Mary Burke, a member of the Madison school board and former state secretary of commerce.