United States military records are useful to genealogists for a couple of reason. Obviously they provide service information, but they can also help in other ways to knock down brick walls. For example, if a researcher has been unable to find a marriage record for a Civil War veteran whose widow applied for his pension, he might find a marriage certificate included in the widow’s application. Of course, there are no guarantees as to what could be found in such records, but they often contain unexpected items that can be both genealogically useful and simply of interest regarding details of an ancestor.
For obtaining a Civil War widow pension, file researchers might want to check first to see what is available on Fold3, which features military records. The database is free to Connetquot Public Library cardholders, if logged in using the library’s link and library card number. Fold3 has a wide variety of military records too numerous to list here. Other databases on Ancestry.com and FamilySearch.org also have United States military indexes and records, as well as other related collections such as World War I and World War II draft registration cards. Links to the National Archives online databases can be found on their website https://www.archives.gov/research/military/veterans/online.html.
Not everything in the way of military records is available online, so genealogists sometimes have to order records. This generally involves some time and expense. To help researchers understand availability of records, the National Archives has a brief description of their collections on their website: https://www.archives.gov/research/military/genealogy.htmlare.
Also, the following links can provide information on ordering records through the National Archives.
Civil War veteran records: https://www.archives.gov/research/military/civil-war
Older Military Service Records: https://www.archives.gov/veterans/military-service-records/pre-ww-1-records
For more recent military personnel records (20th century), researchers need to contact the National Personnel Records Center in St. Louis, Missouri (https://www.archives.gov/st-louis/military-personnel). The NPRC is the repository of millions of military personnel, health, and medical records of discharged and deceased veterans of all services during the 20th century. However, a fire in 1973 at facility destroyed approximately 80% of Army personnel records from 1 Nov 1912 to 1 Jan 1960; and, 75% of the Air Force records from 25 Sep 1947 to 1 Jan 1964. Millions of military service files, including those for WWI and World War World II were destroyed. If you are seeking the record of a World War I navy veteran, the chance of surviving records are greater.
To learn more about United States military records, I recommend the website https://familysearch.org/wiki/en/United_States_Military_Records. It provides researchers with background information along with many links to online sources.