Yes, you can't use evidence that was obtained illegally to prosecute someone for a crime. Their guilt or innocence has nothing to do with it.
If illegally acquired evidence was admissible in court, the police would have every incentive to ignore people's rights on a regular basis, conducting illegal searches and seizures, breaking into homes without a warrant, etc., in order to obtain evidence. On balance, this is much worse for society than one guilty person going free.