If you have been convicted of a felony, and are in the U.S. but not a citizen, you are right to be worried about the prospect of deportation (removal) from the United States. There are two issues to worry about, depending partly on whether or not you were here in valid, documented legal status to begin with. These include whether you will come to the attention of U.S. immigration authorities, and whether your crime is on the list of crimes that make a person deportable.
Once you've been arrested, jailed, or imprisoned, communication between law enforcement personnel and immigration authorities make it likely (though not guaranteed) that the latter will learn of your arrest. They might put an immigration "hold" on you, meaning that as soon as you're about to be released from jail or prison, you will instead be transferred into U.S. immigration custody. There, you're likely to face immigration court proceedings.
If you are not in the U.S. with a valid visa or green card, your removal (voluntarily or otherwise) is highly likely at this point—but consult an attorney just in case.
If you do have a green card, you might be able to defend yourself in court, but see the next discussion for more detail.
Even if you already have a U.S. green card, a number of types of crimes can make you deportable, leading to your forced departure from the U.S. and revocation of your lawful permanent resident status. The U.S. immigration statute (I.N.A. § 237) both lists a few specific crimes and broadly describes other categories of offenses that can lead to deportation.
For example, some crimes of "moral turpitude," as well as those involving controlled substances, firearms, and domestic violence, as well as "aggravated felonies," are among the many that can make a person removable. What's an aggravated felony? It can include everything from murder, rape, and sexual abuse of a minor, to other crimes involving violence, to theft, drug and weapons trafficking, and more.
Many of the crimes that U.S. immigration authorities have been interpreted as "aggravated felonies" were called misdemeanors by the state court that convicted the person. The message here is that you'll need an attorney's help to figure out whether your crime is, indeed, a ground of deportability.
The specifics of what constitutes a deportable offense are often based individual facts and recent case law. If you have been convicted of a felony, or indeed any crime, you would be best served to contact an immigration attorney for a full analysis and possible defense against removal from the United States.
And if you're still facing criminal charges, call an immigration attorney right away. Your criminal lawyer may not realize the various ways in which your conviction, guilty plea, or sentencing will impact your immigration status. With an immigration attorney's help, you might be able to negotiate a result that's less harmful to your rights as a U.S. immigrant.