Signing a Muslim ban while American forces are currently engaged in majority-Muslim countries where they rely on Muslim allies on the battlefield is an incredibly reckless thing to do. It's even more reckless when the Department of Defense is completely blindsided by it.
Pentagon officials are now trying to figure out how to carve out exemptions for foreign service members, non-citizen American service members, and foreign contractors who've worked with American forces since the Iraq War.
Among the questions hanging over the order and its implementation are the fate of Iraqi military pilots currently training in Arizona, as well as other Iraqi officers in the United States, and the thousands of U.S. service members who hold foreign nationality. Defense officials couldn’t provide a breakdown by country, but said that the Pentagon typically recruits about 5,000 non-citizen, legal permanent residents per year, and the average number of non-citizens on active duty has averaged about 18,700 since 2010.
Secretary of Defense James Mattis was present when Trump signed the order, but that doesn't necessarily mean he knew what was really in it. That also doesn't necessarily mean Trump's handlers would have allowed Mattis to interfere. All indications point to Trump not consulting anyone outside of his inner circle before signing the order.
I can't imagine Trump's actions will help the Pentagon with recruitment. It will almost certainly endanger the lives of Americans overseas.