The Supreme Court ruling is a potentially significant one for Republicans, who are trying to retain their majorities in both chambers of Congress.