Trump's comment came one day after a report warned of dangerous overcrowding in the facilities. (File)

US President Donald Trump brushed off reports of overcrowding and squalid conditions in migrant detention centers Wednesday by saying the migrants can opt "not to come" to the United States.

"If Illegal Immigrants are unhappy with the conditions in the quickly built or refitted detentions centers, just tell them not to come. All problems solved!" Trump tweeted.

The comment came one day after a Department of Homeland Security (DHS) report warned of "dangerous overcrowding" in the facilities, which hold thousands of migrants seeking to remain in the country, most of them fleeing violence and poverty in their Central American homes.

And it follows Democratic lawmakers who also visited detention facilities reporting massive crowding in cells with no running water, children and adults lacking access to needed medicines and deprived of showers for up to two weeks.

The reports raised pressure on the Trump administration to shut the facilities and release the migrants.

On Tuesday, the DHS inspector general released its latest in a series of reports on facilities and camps for the hundreds of thousands of migrants who have crossed the border from Mexico in recent months, most of them in families.

Acting DHS Inspector General Jennifer Costello urged the department, which overseas border enforcement, to "take immediate steps to alleviate dangerous overcrowding and prolonged detention of children and adults in the Rio Grande Valley."

The report included images taken at several Texas sites, showing dozens of migrants including young children packed shoulder to shoulder into cage-like holding areas or cells.

Costello said one detention facility manager described the situation as a "ticking time bomb" and raised security concerns for agency staff and detainees.

Children at three of the five Border Patrol facilities had no access to showers and few spare clothes, while two facilities had not provided hot meals, only sandwiches.

Most single adults had not had a shower in a month and were being given wet wipes. Some detainees were suffering from constipation after a diet consisting only of bologna sandwiches.