Weiner, 53, started to cry as soon as the sentence was announced by US District Judge Denise Cote in Manhattan. His wife Huma Abedin, an aide to Democratic presidential candidate Hillary Clinton, was not in the courtroom and has filed for divorce.
He pleaded guilty in May to transferring obscene material to a minor, and agreed he would not appeal any sentence of 27 months or less.
"I was a very sick man for a very long time, but I'm also responsible for the damage I have done," Weiner read from a statement in court before he was sentenced. He said he was being treated, and asked Cote to spare him prison and sentence him to probation so he could continue treatment.
Weiner's lawyer, Arlo Devlin-Brown, said that while Weiner exchanged sexually explicit messages with many women, all of the others were adults.
Cote said she believed Weiner was suffering from an addiction, and was serious about being treated. However, she said it was important to deter others from committing similar crimes.
"There is the opportunity to make a statement that could protect other minors," she said.
"We are of course disappointed that Anthony was sentenced to prison, particularly so given that Judge Cote found that the treatment program Anthony had engaged in for the past year was showing great promise and should be continued," Weiner's lawyer, Devlin-Brown, said in a statement Monday afternoon.
Weiner declined to speak to reporters as he left the courtroom. He was ordered to surrender by November 6.
Weiner, who wore his wedding band at the sentencing, and Abedin have a son, Jordan, who is 5 years old.
The discovery of the emails prompted James Comey, then director of the Federal Bureau of Investigation, to announce in late October that the agency was reopening its investigation into Clinton's use of a private email server while she was US secretary of state.
Clinton has said the announcement contributed to her upset loss to Republican Donald Trump, who had accused her of endangering national security by using the private server.
President Trump fired Comey in May amid the FBI's probe into whether his campaign colluded with Russia to defeat Clinton, a claim the president has denied.
Weiner represented parts of New York City in the US House of Representatives for 12 years before resigning in 2011, after it emerged that he had exchanged sexually explicit messages with adult women.
In 2013, Weiner ran for New York City mayor, but was defeated in the Democratic primary after more lewd messages became public.
(This story has not been edited by NDTV staff and is auto-generated from a syndicated feed.)