It is often the case that following the conviction of a foreign national for a crime in the United Kingdom the Secretary Of State will seek to deport that person.
It is usually only possible to challenge a decision to deport someone on the basis that the deportation/removal would be a breach of their human rights or a breach of the refugee convention.
The Home Office, on most occasions, do inform the convicted foreign national whilst they are still serving their prison sentence with a formal decision and appeal forms. There is a strict time limit for responding. This is a very complex legal area and professional legal representation is essential.