LONDON—A British judge sentenced Julian Assange to 50 weeks in jail for skipping bail in 2012 while awaiting extradition to Sweden on sexual assault accusations, a blow to the WikiLeaks founder ahead of a hearing on whether he should be sent to the U.S. to face trial over the leak of classified documents almost a decade ago.

In April, Mr. Assange was indicted in federal court on a computer-hacking conspiracy charge in connection with what prosecutors described as “one of the largest compromises of classified information in...