It fits in with his rants about how “they’re not sending their best”. He thinks that foreign governments are clearing out criminals and other riff-raff and dumping them in the USA.
Somewhere in Trump’s addled mind he might be remembering the Mariel boatlift.
The Cuban government facilitated an emigration process that gave special privilege to those who were socially undesirable. People deemed homosexual would be allowed to leave the country. Those with gender non-conforming behavior were especially targeted by authorities for departure. Some of them were given the option between emigration and jail time, in order to encourage their departure from the island. Many Cubans would enter police stations and state that they engaged in homosexual behavior whether true or not, simply to be granted permission to leave the country.