The military guarded this nation's borders in the 19th and early twentieth century before the creation of the Border Patrol.  There is nothing in the constitution that prevents the military from protecting this nation's borders.