Modern factory farm practices shoulder much of the blame for the current swine flu outbreak, according to a statement from the Humane Society of the United States. In factory farms, pigs are raised in horrific, intense confinement. Moreover, they are often cared for by the same staff assigned to adjacent poultry operations. Trucking the animals (in the heat, in confinement) allows for the quick spread of the disease across long distances. Surely the amount of antibiotics given to factory farmed animals exacerbates the situation (for more on this, visit the Sustainable Table).
While factory farming likely sparked the swine flu outbreak (not to mention avian flu), people get swine flu from other people who have been infected, not from eating animal products, though that would be poetic justice. To avoid infection, use good hygiene–wash your hands frequently, cover your mouth and nose when coughing and sneezing, and, in areas where swine flu has been reported, avoid hugging, kissing, and touching others.
To reduce the likelihood of more outbreaks or other diseases associated with factory farms, work to require humane conditions for farm animals. Though you may only be doing it for your own health, it is the very least these animals deserve.