I feel they should. The US military deserves our support in every proper way possible. Google recently said it won't renew its contract with the Pentagon.
"Technology is becoming extremely important in improving security measures both in the digital and real world. That said, don’t technology companies have a role to play when it comes to national security and tackling crime at all levels? When it comes to applications like facial recognition and location tracking, would the companies refrain from helping the government in identifying potential threats?"
Source -
How much control does Google have on its AI projects? | AlphaStreet
Google and other tech companies are just that, tech companies, not defence companies, which means a completely different outlook and focus, as well as drawing from a very different pool of talent. Also being tech companies and more specifically software/data companies they have offices all over the world which can access their 'products' unlike a defence company like Boeing or Lockheed Martin, where physical access to the company product can be tightly controlled. This could be important, especially if the nation where a satellite office is located ends up demanding access to data, or source code.
Lastly, there is serious potential for negative implications in developing facial recognition, location tracking, and similar software, as well as managing the underlying data. Yes, such systems and data could be potentially used to identify a threat, but they can (and have) been used for other purposes, including ones which would impinge on a citizen's freedoms and civil liberties. That is just for operations here in the US. Those same tech companies which develop and/or manage a defence related product and have offices overseas could find themselves having to either build or grant access to similar systems in whatever host country the office is located in, which might not have the sorts of freedoms the US has.
Always consider not only what/how data is supposed to be used, but also how it can be mis-used. Facial recognition and location tracking software can and have misidentified people and locations, and authorities can become complacent or reliant on some of the tools which could get developed. Imagine getting questioned, never mind charged, based off gov't pulling track data and realizing (or just believing) that you had been to a specific location of interest. IMO it would just be a matter of time before such a tech capability would be abused, should it get developed.