Assange was sentenced for breaching his bail by entering the Ecuadorian embassy seven years ago.
Ahead of his sentencing at Southwark Crown Court in south London, Assange apologised for skipping bail in a letter read by attorney Mark Summers.
He said he found himself “struggling with terrifying circumstances” and did what he thought best.
He apologised to those who “consider I’ve disrespected them,” a packed Southwark Crown Court heard.
“I did what I thought at the time was the best or perhaps the only thing that I could have done,” he said.
As he was taken down to the cells, Assange raised a fist in defiance to his supporters in the public gallery behind him.
They raised their fists in solidarity and directed shouts of “shame on you” towards the court.
Assange sought asylum in the Ecuadorian embassy in June 2012 to avoid extradition to Sweden, where he was wanted for questioning over rape and sexual assault allegations.
But Ecuador evicted him on April 11.
The judges in the case against Assange rejected that the WikiLeaks founder was already punished by being holed up in the embassy for seven years.
“I reject the argument you were living in prison conditions,” the judge said.
A judge at an earlier hearing said the 47-year-old hacker’s offence “merits the maximum sentence.”
He faces a separate court hearing on Thursday over a US extradition request on charges of conspiring to break into a Pentagon computer system.
The UK will decide whether to extradite Assange to the US in response to allegations that he conspired with former US intelligence analyst Chelsea Manning to download classified databases.