The basic principle underlying current rules of evidence is that of probable cause; the police must have a preponderance of the evidence that this suspected person is guilty of a crime in order to search them or seize their property, and with rare exceptions must acquire a warrant on this basis.
If evidence is not obtained according to this rule, the exclusionary rule applies, disallowing the use of that evidence in court. In theory, this is not the only way one could penalize illegal searches, but it is the one we generally use.
The exclusionary rule was first applied in the case Boyd v. United States (1886), and actually applied not to a search per se but the requirement to furnish business documents. It was originally argued that this constituted a Fifth Amendment violation, requiring self-incriminating statements.
Adams v. New York (1904) actually specifically rejected the claim of a general exclusionary rule applied to all illegally-seized evidence, but this precedent did not last. In Weeks v. United States (1914), the Supreme Court ruled that the Fourth Amendment did require all illegally-seized evidence to be excluded from use in federal courts.
This only applied to federal courts until 1952, when in Rochin v. California the Supreme Court ruled that egregious violations of Fourth Amendment rights were sufficient to invalidate the evidence even in state courts. In 1954, Irvine v. California established that this did not apply to all illegal searches, only the most egregious ones.
This standard held until 1961, when in Mapp v. Ohio the Supreme Court generalized the rule to all illegal searches and seizures, and applied it to both state and federal courts.
More recently, the pendulum has begun to swing backward, as starting in the 1970s a series of Supreme Court rulings have weakened or limited the standards of the exclusionary rule and added more and more exceptions. Today the exclusionary rule is only held to apply if the police would not have gotten a warrant---not simply if they didn't---and if the person being searched had a "reasonable expectation of privacy", and it must apply specifically to that person---if you hide drugs in someone else's purse, the evidence can be used against you, just not against them (established in Rawlings v. Kentucky in 1980).