>It seems like at your school they didn't mention habeas corpus
Habeas doesn't apply... no one's trying to prosecute them for a crime. The juvenile confusion you're experiencing, where you believe deportation to be some sort of punishment for a crime, rather than merely the immediate remedy for someone who doesn't belong where they are, well it's bizarre.
If someone breaks into your home tonight, do you think the police can't remove them from the house until after the trial?
The writ of habeas corpus applies to detention, not prosecution. In fact this is why it exists. If it only applied after a crime was alleged, the government could hold people in extrajudicial detention forever so long as it never leveled criminal charges. The Bush administration did exactly that in Guantanamo and was slapped down by the Supreme Court.
It seems like at your school they didn't mention habeas corpus or Magna Carta? Maybe it sounded too scary and foreign?