Everyone who resides in the 50 states of the United States is counted, including noncitizens. U.S. Armed Forces personnel and federal civilian employees stationed outside the United States are also counted.
From the US Census Bureau website:
Who is included in the apportionment population counts?
The apportionment calculation is based upon the total resident population (citizens and non-citizens) of the 50 states. In the 2010 Census, the apportionment population also includes U.S. Armed Forces personnel and federal civilian employees stationed outside the United States (and their dependents living with them) that can be allocated, based on administrative records, back to a home state. This is the same procedure used in 2000.
Are undocumented residents (aliens) in the 50 states included in the apportionment population counts?
Yes, all people (citizens and noncitizens) with a usual residence in the 50 states are to be included in the census and thus in the apportionment counts.
According to this Congressional Research Service report, noncitizens have always been counted in previous censuses.
In the 2010 decennial census, the Census Bureau counted the total population of the United States. This included, as in previous censuses, all U.S. citizens, lawfully present aliens, and unauthorized aliens.
[ ... ]
Some have pointed to the fact that the census has historically included questions about citizenship, thus perhaps suggesting that a distinction has been made between citizens and aliens for purposes of counting individuals. It is true that at least two early censuses (1820 and 1830) included a category for foreigners not naturalized and later censuses asked about place of birth. However, such information was not used to exclude any aliens from the census count. Rather, it is clear that such individuals were included in the total count, and it appears the data were collected for informational purposes (similar to how information was collected about age, occupation, etc). It does not appear that aliens have been excluded from any census.
However, before the Fourteenth Amendment was adopted, slaves were counted as three-fifths of a person for the purpose of apportionment, per Article I Section 3 of the Constitution.
Native Americans were also not fully counted until 1890.
The 1890 census is the first to include the enumeration of all Indians. The 1890 census act states:
The Superintendent of [the] Census may employ special agents or other means to make an enumeration of all Indians living within the jurisdiction of the United States, with such information as to their condition as may be obtainable, classifying them as to Indians taxed, and Indians not taxed.