"of or pertaining to a nation or a country regarded as a whole; established and maintained by the nation; peculiar to the whole people of a country," 1590s, from Middle French national (16c., from Old French nacion), and also from nation + -al (1). Opposed to local or provincial (or in the U.S., state).
Meaning "peculiar or common to the whole people of a country" is by 1620s. From 1802 as "established and maintained by the nation or its laws." As a noun, "citizen of a (particular) nation," from 1887. Related: Nationally.
National guard is from 1793, originally in reference to an armed force in France identified with the revolution; U.S. use is from 1847, originally a name sometimes given to the organized militia. National anthem is recorded by 1806.
A King though he's pestered with cares,
For the most part he's able to ban them;
But one comes in a shape he never can escape--
The implacable National Anthem!
[W.S. Gilbert, "His Excellency," 1894]