First, I do feel the need to explain the racist nature of the statement, mostly because it hasn't come up before and the discussion seemed to just move onto semantics and other stuff.
To ask why they keep accepting people from "Shithole" countries isn't so much a statement on the country's economic state, but it's a statement on its people. If those people are immigrating over, the person is immigrating, not the country. To ask why America keeps accepting people from those countries very, very, very heavily implies that there is no perceived worth in anyone immigrating from that country, that there is nothing of value that they can bring to the table that makes them worth accepting into the nation. Of course, the statement would be limited to only this, if it wasn't for the fact that Trump only referred to African nations and Haiti.
Nations of predominantly black citizens, while simultaneously saying that they should be accepting immigrants from a nation of predominantly white people regardless of how completely opposite that nation is in political ideology. This sort of discourse is incredibly similar to the same narrative that's said when a company hires a more diverse base of employees. People will say "But why would you hire these women for just diversity instead of qualification?" I mean, the hidden narrative right there is that they don't believe women could be more qualified than the men who were competing for the same job. In the same way, Trump is suggesting that he believes literally anyone from Norway is more qualified to be a US citizen than anyone from all of Africa or Haiti. That's problematic.
Now, do I think he meant it in a racist manner? Ultimately, I don't know. I'm not Trump, I don't know his intentions and it's entirely possible that he meant it purely in a manner of speaking about the nation itself, as others in this thread have suggested. However, that doesn't discount what he said, and what he said was really, really not good.
There's a lot of weight in what he said, and to suggest that nobody from any nation of those sorts has anything of value to bring is, frankly, a prejudiced thing to say. It's discounting and devaluing people over something that actually has no effect on their value as a person. There should be no defending what he said. Even as Zai said, there are better ways to phrase it that don't come across as hateful, but honestly the same message is there. Even if you paint it gold and encrust it in jewels, a piece of shit is still a piece of shit (referring to the statement, not the person).
Regarding the issue of immigration itself, no your country does not have an obligation to accept immigrants from, well, anywhere. But there should be good reasoning behind that, not just blind prejudice. Also, I don't know how much everyone here knows about the process of immigration, but it's not as simple as people just being accepted willy nilly easily. Nor should it be. There should be vetting for qualifications, financial position and potential job placement (it'd probably be worse for someone to let them put everything they had to move overseas just to become almost immediately homeless because they weren't prepared), criminal record, etc. And this process does exist; place of origin should have no meaning in the face of this process. If a person qualifies to immigrate, they should be able to immigrate.
People are people. We are all capable of the same potential, to do the same amount of good, and the same amount of wrong. Discrimination from anyone, against anyone, is not right, ESPECIALLY coming from a world leader. If a person is going to go through the effort and the process to become the face of your nation, to be its leader and represent it to the world, then a high standard should be placed upon them. What Trump said was unacceptable, and regardless if you support him or not I would strongly suggest you think about what it is that he said and what's going on. A nation's leader should always be under scrutiny, by its supporters and opponents alike. That's part of how a nation grows and becomes a better place, when its people hold its leader accountable for their words and their actions.