The history of immigration and naturalization laws in the United States exposes the racial and sexual prejudice that often invaded the psyche behind legislation that has historically (and still today) excluded certain groups from access to citizenship and certain rights based on their race, sexuality, and other intersections.
One of the first such examples in American history occurs in the late 1800s, with the Page Act and the Chinese Exclusion Act, the former meant to keep out what legislator believed to be "immoral women" or prostitutes, but really it was meant to keep out women of color, specifically Chinese, Japanese and any Asian women. The latter was legislation banning any Chinese immigrants. Both of these pieces of legislation can refer back to this consistent idea of a "desirable citizen" and how the state is constantly defining what that means and thus defining who can have access to what rights (or no rights at all).
The Page Act sought to prevent the Chinese men who were working in the United States from bringing their wives to America and giving birth to Chinese children that would be birthright citizens. Additionally, it wished to police and stereotype the sexuality of non-white women and thus prevent their entry into the US and citizenship. The Chinese Exclusion Act was quite explicitly racist in that non-white immigrants were targeted and was another form of population control on the Chinese population both in the US and outside of the US.
One of the founding fathers of America, Thomas Jefferson, disapproved of immigration, believing a "homogeneous" society was preferable and more peaceful and the principles passed onto the next generation would be untainted by foreign taught ideas.
This concept informs the thought process behind the Chinese Exclusion Act and even the xenophobia that exists in America today in regard to bringing in refugees and undocumented groups.
People coming into Ellis Island were bodily investigated for signs of "lack of sexual development" and these people were also questioned on their sexuality, sexual tendencies, and marital intentions. Criteria such as genitalia size or genital abnormality were used to draw conclusions of abnormal sexual practices and even economic dependency, and these conclusions were used to deny passage to said persons. Regulation of immigration seeks to regulate what kind of sexual behavior is acceptable and thus whose sexual behavior is aligned with the ideal immigrant and thus is granted passage into American and given the opportunity to become a citizen.