Navanethem Pillay, a judge from South Africa, said they are among millions of people believed to be detained arbitrarily or unlawfully worldwide, with many held in inhumane conditions without facing charges.
"We have a number of concerns with increasingly restrictive and often punitive approaches to migration in many developed countries of which the EU’s recent return directive is one example," she told a news conference.
"The great majority of immigrants, refugees and asylum seekers are not criminals and therefore should not be confined in detention centres like criminals," Pillay said.
Under the EU plan agreed last May, illegal immigrants to the 27-member bloc can be detained for up to 18 months before being sent home, and also face a five-year re-entry ban.
Referring to that maximum detention period, Pillay said: "This appears excessive, especially if obstacles to removal are beyond the immigrant’s control, for example if their home country fails to provide the necessary documentation."
States are meant to use detention only as a matter of last resort, according to the former International Criminal Court judge who took up the top United Nations human rights job last month, succeeding Louise Arbour.
"It is very much feared that EU states may resort to detention excessively and make it the rule rather than the exception," Pillay said.
She also called it "troubling" that the EU could allow the detention of unaccompanied children in its new rules, which have prompted accusations of xenophobia from outside the bloc.
Brussels says there are up to 8 million illegal migrants living in the EU’s 27 member states. About 200,000 were arrested in the first half of 2007 and fewer than 90,000 were expelled.
EU interior ministers last week backed a fast-track scheme to attract highly skilled workers from developing countries. Brussels is seeking to boost its fight against illegal migration while promoting legal migration and a common asylum policy.