Birthright citizenship, or automatic citizenship to all born in the United States, is enshrined in the 14th Amendment of the Constitution and confirmed by an 1898 Supreme Court ruling, United States v. Wong Kim Ark. 

All persons born or naturalized in the United States, and subject to the jurisdiction thereof, are citizens of the United States and of the state wherein they reside.

As Tribe noted on Twitter, the 14th Amendment was a direct result of the Civil War, and was ratified to ensure citizenship to former slaves: