Villains like Magneto and others have been members of the X-Men, but have the Avengers ever allowed a villain to join their ranks?
Absolutely. The Avengers are a curious team in that their solution to many of their supervillain problems has been to turn them and recruit them to the team. This has two major benefits: It keeps the former villain under close supervision and often brings unique skills, powers and perspectives to the Avengers.
This list is by no means all-inclusive, it mentions notable villains-turned-Avengers:
The Kree Captain Mar-Vell was sent to Earth by the Kree to observe and report on Earth's technological capacities as a prelude to invasion. The good Captain decides to turn against the Kree and aligns himself as a protector of the Earth. He will eventually become an honorary Avenger and save the planet several times alongside the Avengers.
The Vision, a staunch member of several eras of the Avengers was created by the robot Ultron. The Vision was a "synthezoid" (described as android made from components that resembled human organs) designed to lead the early Avengers into a trap. The Wasp is the first to encounter the synthezoid, and describes it as a "vision" while trying to escape.
Adopting the name, the Vision is convinced by the Avengers to turn against Ultron. (Avengers vol. 1, Issue #57) After learning how Ultron created him, using the brain patterns of then-deceased Simon Williams (Wonder Man), the Vision becomes a member of the team. (Avengers vol. 1, Issue #58)
Wonder Man (Simon Williams) was also a super-villain sent to infiltrate the Avengers by Baron Zemo of the Masters of Evil. (The Avengers #9 - cover-dated Oct. 1964) He betrays the Masters of Evil and fights alongside the Avengers dying during his efforts. His brainwaves are recorded and stored. Unbeknowst to the Avengers, Wonder Man's body was changing and he would eventually return to life, more powerful than before.
The Swordsman appeared in Avengers Vol. 19 (1965) as an enemy of Hawkeye. He eventually becomes an Avenger in Avengers Vol. 1 #112-130 (1973–1974). The Swordsman was an athletic man with no superhuman powers, and was a cunning criminal strategist and highly adept at unarmed combat. The Swordsman was a master in the uses of bladed weapons, especially swords, and his main weapon was a sword created by the super-villain Mandarin from Makluan technology. He also carried various throwing knives and daggers as needed.
The Black Widow: Was a cold-war operative who spied for the Soviet Union and had come into conflict with Iron Man over the years. After defecting and working for SHIELD she eventually joins the Avengers.
The Black Knight: The original Black Knight was a villain who attacked the Avengers. After realizing he had made a mistake he asks his nephew Dane Whitman to restore the family honor and he worked to restore the name of the Black Knight by becoming an Avenger.
As mentioned in other posts: Hawkeye, QuickSilver, and The Scarlet Witch also began their careers as villains before becoming Avengers.
Norman Osborn took over the Avengers for a while and Ultron disguised himself as a Tony Stark.