The British musician, 70, became "violently ill" on a flight home from his recent South American tour, spokeswoman Fran Curtis said in a statement.
The "Rocket Man" singer spent two nights in intensive care in the UK and is resting at home after being released on Saturday, the statement said.
The infection was not identified, but the statement said John contracted the "harmful and unusual bacterial infection" during his South American tour, which ended in Chile on April 10.
"Infections of this nature are rare and potentially deadly," the statement said, adding that his time in intensive care was followed by an "extended stay in hospital."
John is expected to make a full recovery but has canceled all his concerts in Las Vegas for April and May, as well as a gig in Bakersfield, California, on May 6.
John apologized to fans for disappointing them, adding in a statement: "I am extremely grateful to the medical team for their excellence in looking after me so well."
He is due to resume performances at a concert in Twickenham, England, on June 3.
John, a Grammy, Oscar and Tony winner for his work in film and theater, is working on a score for a Broadway musical adaptation of the comedy-drama "The Devil Wears Prada."