This oversimplifies the original idea behind what you're trying to recall. Being sick in and of itself is not the beneficial part, it's exposure that can be beneficial in certain cases. If you can get the exposure without actually falling ill it's all the better, it's a win-win. Note that not all exposure is good, for example you never want to be exposed to the bubonic plague if at all possible.