Yes, it is not illegal because it was common in 6th century Arabian world. North India had been strict about who you can/cannot marry and so this practice comes from Arab tribals into Islam.
Just one example study from Iran: http://www2.sci.u-szeged.hu/ABS/2003/ActaHP/4747.pdf
Btw, the farther...