I understand it's an expression of agreement. What exactly does it mean and where did it originate from?
"I'm down with it" or more often "I'm down with that" is confirmation, acceptance as in "that's fine by me", or commitment. It's originally African American jazz slang from around 1935.
It was popular during the 1990s especially in rap and hip hop, also in the 1970s, and in jazz from the 1930s to at least the 1960s.
Webster's New World American Idioms Handbook (2011) says:
I'm down with that: slang; means “I'm agreeable to that”
A poster on Wordreference.com (2006) said:
In AAVE [African American Vernacular English] "I'm down" or "I'm down with that" can mean "I am in", I will commit to that action or position, or I am on your side.
Our Souls to Keep: Black/White Relations in America (1999) by George Henderson equates "I agree" with black English "right on" and "I'm down with that".
Law Enforcement Vocabulary (1973) by Julian A. Martin:
I'm Down With You. Juvenile slang: I'll fight on your side.
This version was used in Buffy The Vampire Slayer in 1998, showing overlap between being friends with someone or generally agreeable with them, and and described as mainstream slang in the book Slayer Slang: A Buffy the Vampire Slayer Lexicon (2004) by Michael Adams (first published online in 1999):
If Faith's Goth-chick slang veers towards the obscure, other characters favor the teen mainstream: ... "So, you're not down with Angel," she acknowledges of Spike, Angel's rival among Sunnydale vampires; ...
The American Heritage Dictionary of Idioms (1997) shows a slightly different use:
4. be or get down with. Be close friends with, as in I'm down with that crowd. [Slang; late 1900s]
From the introduction to A Jazz Lexicon (1964) by Robert S. Gold:
A few terms, perhaps because of their simplicity and widespread applicability, have survived from the early jazz life... The jazz slang speaker's aloofness is tacitly justified by his feeling that only those who are down with the action (aware of what is going on) should have access to the speech of those who have paid their dues (suffered an apprenticeship in life generally and in the jazz life in particular).
And its own entry (read online):
down with, [poss. from gambling slang to be down (i.e., to have one's bet placed) and poss. from general colloquial down to his toes (or socks); current esp. among Negro jazzmen since c. 1935] See 1957 and second 1959 quots. — 1944 Dan Burley's Original Handbook of Harlem Jive, p. 15. "I'm down with the action." — p. 41. Othello, the spade stud, pops in port, "down with it, cause he can't quit it." — p. 47. Iago is down with the action. — 1946 Really the Blues, p. 369. down with it: top-notch, superlative. — 1955 Down Beat, 5 Oct., p. 51. I don't know who the singer is, 'cause I'm not down with all the singers now. — 1957 The Book of Negro Folklore, p. 483. down with it: to get acquainted with, to understand. — 1959 Diggeth Thou?, p. 23. Let's see what's down with the deal. — 1959 Esquire, Nov., p. 70I. down with something, to be: to know something thoroughly. — 1960 Beat Jokes Bop Humor & Cool Cartoons, p. 57. The Ham wasn't down with the action.
From an interview with rapper Guru from Gang Starr in Blues & Soul magazine (1990):
"You see I'm down with anything that's about uplifting and giving self-esteem to the black man. You see the black man in cities in America, over here and around the world . . . they need self-esteem because a lot of them see it as society's so hard on them they can't get it together. What these religions are based on is building pride, awareness and knowledge of culture and self, and that is important. So, anything like that I'm down with. That's why I say 'I'm down with the Nation [of Islam]"
Ebony magazine (January 1976):
Buffalo's Randy Smith, a former NSSFNS recipient, said he was determined to make the tournament, with or without his club's blessings. "That's how most of the players felt," said Smith. "The tournament is designed to help black youngsters, and anytime there is something I can do to help the cause, hey, I'm down with it."
"Don't bet on that. Chumps like to deal with a winner, if you know what I mean. I'ma stone hustler. I'm down with it, dig? And he threatened me, even if it was with ...
From Mezz Mezzrow's autobiography Really the Blues (1946) , in a reference to jazz slang of the 1930s:
first cat: Hey there Poppa Mezz, is you anywhere?
me: Man I'm down with it, stickin' like a honky.
A translation of terms appears in the glossary:
Down with it: top-notch, superlative
To supplement Hugo's excellent answer, I offer a couple of fairly early in-the-wild examples of "I'm down with it" as used by black American scenesters of the 1940s and 1950s.
First, from "'Harlem Jive Solid'; So Dan Burley's 'Loaded'," in the Indianapolis [Indiana] Recorder (December 2, 1944), a historically black newspaper:
Dan Burley, managing editor of a Harlem weekly and author of "Harlem Jive," was one of the most sought after men in town this week following publication of his widely publicized handbook.
To the amazement of "serious thinkers and jive artists," alike, Burley's book which he is publishing himself sold more than 3,000 copies in five days.
Burley, one of the most popular newspapermen in the city, took it all in stride and promised something better next time. "Meanwhile," he said, "I'm down with it, ole man, found with it, bound with it, around with it and gowned with it. In other words, I'm a hip kitty from New York City."
The sense of "down with it" here seems to be "hip to it."
And from Bob Womack, "Musical Upbeat," again in the Indianapolis Recorder (November 30, 1957):
Hi friends, the jive is wild as an untrained colt, and I'm down with it and can't quit it, so I'll unload the whole deal on you cool cats and the slick chicks. I'll take off on the local news first.
Womack's meaning seems identical to Burley's 13 years earlier.
J.E. Lighter, Random House Historical Dictionary of American Slang (1994) lists two quotations from Burley's 1944 Handbook of Jive as the earliest instances of "down with" in two distinct senses:
6. Black E[nglish] a. ready and eager for action; (also) formidable in a fight; tough. [First cited occurrence:] 1944 Burley Hndbk Jive 137: Down with It...to be ready for action. ...
b. knowledgeable or conversant, esp. thoroughly.—constr[ued] with with; (hence) smart; canny; sophisticated; HIP. ...[First cited occurrence:] 1944 Burley Hndbk Jive 15: I'm with it....I'm down with the action to my own satisfaction. Do you dig? Ibid. 47: That square, Iago, is down with the action. Ibid. 137: Down with it—To understand, know.
In short, if you have to ask what "I'm down with it" means, you're not down with it.