The veteran Irish actor has had a course of chemotherapy after he was diagnosed with Hodgkin's disease, his agent told BBC News Online, but would not disclose when the diagnosis was made.
The 72-year-old has been in University College Hospital, central London for two months, where he has had a course of chemotherapy.
But he is expected to be discharged in time to work on the third Harry Potter film, The Prisoner of Azkaban.
His agent said: "He has responded very, very well to treatment and he should be out of hospital soon.
"He absolutely will be in Harry Potter. Filming is not due to start until March," his agent added.
Seven-film contract
Harris became ill in August after filming the second Harry Potter film, The Chamber of Secrets, and went to hospital suffering with a severe chest infection.
The movie, based on JK Rowling's books about the boy wizard, is due out in cinemas in November.
Harris, who has been known previously for his hellraiser lifestyle, is signed up to play the head of Hogwarts in all seven movies.
The actor, who starred in Gladiator, A Man Called Horse and This Sporting Life, is expected to undergo further tests in the future to see if more treatment is necessary.
Hodgkin's disease, which affects the lymph glands, is normally treated with radiotherapy, chemotherapy or both.