Zoophilia and the law looks at the laws governing humans performing sex acts on animals. Laws against humans performing sex acts on animals, where they exist, are concerned with the actual act, which it commonly refers to as bestiality, rather than the sexual attraction to animals. For this reason, prohibitions of zoophilic pornography is more varied; they may be unlawful if an actual sex act with an animal is involved, but the status is not clear cut if there is a mere representation, such as a painting or cartoon. In that case, normal obscenity laws will normally apply. All zoophilic imagery is widely regarded as pornography.
Laws on bestiality tend to be shaped by animal welfare concerns, moral views and cultural beliefs. In many cultures across the world having sex with animals is often seen as subhuman, immoral and distasteful. In many cultures, humans are seen as fundamentally different from other animals and having sex with animals is seen as defilement.
For centuries, sexual acts on animals were illegal under sodomy laws or "crime against nature" laws. Since the 1950s most sodomy laws have been repealed and in some places specific anti-bestiality laws have been enacted.
Some jurisdictions list laws very clearly, such as England and Wales, which specifically prohibits penetration of a human being by the penis of an animal, and penetration of an animal by a human's penis.
By contrast, many countries and US states are less precise about the scope of law in that they outlaw sex with animals, without defining what constitutes "sex".
Even if bestiality is not explicitly prohibited, there are often many other laws which can be used to effectively prosecute cases. For example, most countries have animal cruelty laws, and a prosecutor will argue that all zoophilia activity is animal abuse. In some U.S. states, a person who engages in bestiality can be charged with animal cruelty.
Prohibitions without specific bestiality statutes
Some countries have a range laws on their books. Sometimes sodomy laws or "crime against nature" laws are used to prosecute people who have sex with animals.
In the case of Kenneth Pinyan, who died from injuries sustained from receiving anal sex from a horse, local law enforcement found that there were no laws that allowed them to prosecute his friend, who had filmed the event and also allowed himself to be sodomized by the horse. The friend was prosecuted for trespassing. That case prompted the Washington State legislature to draw up legislation outlawing sex with animals.
In a 2005 Florida case, a man who had sex with his dog was charged with disorderly conduct, since the state had no anti-bestiality laws on the books at the time. On October 1, 2011 the state of Florida State Law 828.126, F.S went into effect, banning sex with animals.
Laws against zoophilia
Aggrawal has discussed extensively on laws against zoophilia. It is permitted in a few countries, such as Sweden and Denmark, although ordinary animal treatment laws apply. In other countries, such as Russia, bestiality is legal, but zoophilia pornography is illegal.
There are also commonly laws against forcing another person to engage in zoophilia activity, especially minors (usually considered equivalent to rape), and laws related to exposing others (either non-consensually or minors) to the sight of a sexual act. In some jurisdictions, laws against zoophilia conduct also include provisions for seizure of animals where convicted.
Sexual handling of an animal for the purposes of veterinary practice, or animal husbandry (breeding), is normally exempted where such laws exist. In public discussion for the recently passed Oregon law, however, one animal shelter's spokesperson wanted the husbandry exemption kept out, as he was concerned that someone might use these "accepted farming practices" as a legal loophole to then have (legal) sexual contact with an animal only for personal enjoyment. One of the legislators responded by asking if they were trying to outlaw an act (of sexual contact), or a state of mind. The veterinary and husbandry exemption was left out of Oregon's law in the final, enacted version.
The legality of pornography has three components: legality of production, legality of sale and transportation, and legality of ownership. In general, animal pornography is legal to produce where both zoophilic activity and the creation of pornography in general are legal. Laws concerning sale, transmission and ownership vary more widely.
Erotic art, such as animal pornography in cartoons and the like, which does not require the recording of an actual sexual act, are not usually considered sex with animals by the law, and so their status depends upon more general laws such as legal limits upon obscenity or pornography alone, and the thin line between erotic art and pornography.
Illegal since 2012 (Penalty: Maximum 3 years in prison, donation to animal welfare charity and prohibition of owning an animal for up to 10 years. If done in order to distribute or sell the penalty is increased to a minimum of 6 months and maximum of 8 years in prison)
Illegal (Penalty: minimum of 6 months and maximum 8 years in prison)
Legal (as long as it is not owned with intention of publicizing, sharing or selling)
"Freddie the Dolphin" (1991, UK) - man accused of masturbating a well known tame dolphin at sea. Charged with a "lewd act". Acquitted. Expert witnesses testified male dolphins use their erections not just sexually, but socially as well, and no sexual inference could be drawn. Judge summing up said of the £30,000 trial cost, "this has been the most expensive lesson in dolphin sociology that he has ever heard of".  (dead link)
Kenneth Pinyan (2005, USA) - man died following anal penetration by a stallion, which was filmed by his friend. The death led to rapid introduction of laws in the state against sex with animals.
Sudan (February 2006) - man caught having sex with a neighbour's goat, is ordered by the council of elders to pay the neighbour a dowry of 15,000 Sudanese dinars ($50) and marry the animal. 
Cambodia (2005) - man caught having a "passionate embrace" in bed with dog, by wife, confessed he loved the dog more and they separated. Cambodian police commented: "As police, we could only solve the problem of his wife then wanting a divorce. We cannot solve the problem of his relationship with his dog, because under Cambodian law it is not strictly illegal... It is amazing, but this husband is not crazy. It seems he is a passionate human being who looked at a dog, and the more he looked, the more passionate he became."
Wisconsin, USA (2007) - Bryan James Hathaway was convicted for having sex with a dead deer. The court case raised some interesting legal issues because the statute prohibits sex with animals, but not carcasses. The defence raised the issue that if a dead animal was an animal, at what point would it cease to be an animal.
Kansas, USA (2012) - Joshua Coman was convicted in Kansas of criminal sodomy (a misdemeanor), but the Kansas Supreme Court ruled that he did not have to register as a sex offender.
Vancouver, Canada (2012) - Brian Cutteridge, bestiality proponent, was arrested after the SPCA claims to have a video of him engaging in sex with one of his dogs.
Arizona, USA (2012) - Sarah Dae Walker and her husband pleaded guilty to conspiracy to commit bestiality in a case where Craigslist was used.
^The argument that "all sexual activity with animals is automatically abuse" was made for example, in 1) the 2004 case of State vs. Mitchell (Florida), 2) the 2004 Pony case in Utrecht, Holland (cited below), and 3) the 2006 Washington state law which asserts as its foundational premise that "animal cruelty in the first degree is committed when a person knowingly engages in sexual conduct or sexual contact with an animal." SB-6417 2006
^Ref: Halsbury's Laws of Australia #9 page 247662: Criminal offence: New South Wales (Crimes Act 1900 s79, not more than 14 years imprisonment), Northern Territory (Criminal Code s138, not more than 3 years imprisonment), Queensland (Criminal Code s211: "carnal knowledge of an animal", not more than 7 years imprisonment), South Australia (Criminal Law Consolidation Act 1935 s69, "buggery with an animal", not more than 10 years imprisonment), Tasmania (Criminal Code s122(b), not more than 21 years imprisonment), Victoria (Crimes Act 1958 s59, not more than 5 years imprisonment), Western Australia (Criminal Code s181: "carnal knowledge of an animal", not more than 7 years imprisonment), Australian Capital Territory (Crimes Act 1900 s63A inserted in 2011, "Bestiality", not more than 10 years imprisonment).