If you study animals enough, you will begin to see that they, like us, can sense when something is not right, whether in their prey or in their companions. Experiment after experiment has been conducted over the years in the effort to determine what animals can or cannot do. I have heard of several studies that focused on animals "sniffing out" cancer; all were interesting, and all left me with the same conclusion.
The question of whether an animal can detect cancer may be too specific. Animals are quite intelligent, and I know this from raising dogs all my life, but their brand of intelligence is likely very different from ours. So it would be rather presumptuous (and bordering on arrogance) to call them dumb, but since their intelligence probably exists on a different plane, they would not know "cancer" from "influenza." If you sat two sick people in a room, a dog could certainly tell which one was in the worse condition, for their sense of smell is so powerful. And, for sure, they can tell the difference between a sick person and a healthy one. Because of the limits of communication between human and animal, though, a broad scope of things (such as what I just hypothesized) is probably near the limit of what can be done; from there, it's up to the doctors to determine the nature of the sickness and how to treat it, etc.
Police dogs sniff out drugs every day, but does a dog know which is cocaine and which is marijuana? They can tell a difference, because the smell is different, but they use scents for information, in place of our words and images.
So, while I question the specifics of what an animal can sense, and more so, how reliable we are in interpreting the answers they give us, an animal can certainly detect the presence of sickness. It's pretty reasonable, actually. Domesticated animals are distant copies of their wild kin-tame, but retaining the same instincts and senses of their predecessors. If possible, a wolf pack will take a sick buffalo instead of tangling with a healthy one. But how do they determine if the prey is vulnerable? They may use senses we have yet to understand, but one is surely the sense of smell. Something in the air, directly linked to that individual, tells them that something is not right, that that animal is weak somehow. What follows is an investigation, a prodding, to see if what they sense is true. If wild animals can do this, it shouldn't be a leap of logic to believe that domesticated animals can detect sickness in humans, or in each other, for that matter.