Posse Comitatus would not affect troops on the border. You mean that an invading army could not be fought back? It refers to enforcing domestic policy inside the U.S.
That would be a war situation...Enforcing domestic policy inside the United States responsibility falls to the National Guard and the Coast Guard, not the Army, Marines, or Navy...
Of course, if President Trump was referring to Nat’l Guard troops, he would be totally correct...