Dogs humping other dogs, animals, people and things is a normal inclination, though not necessarily something you want to watch or tolerate. Humping can be sexual in nature, particularly with young, unaltered dogs. It can also be linked to behavioral issues, or in some instances, be related to health. You can put a stop to the behavior in several different ways, but it's most successfully reduced when tempered early on.
Dogs nearing or at the age of sexual maturity hump both in practice for real sexual encounters and eventually for actual mating purposes. Both males and females can exhibit this behavior. Spaying or neutering your dog can help reduce this inclination and also eliminate the potential for unwanted breeding. However, it may not entirely stop humping, especially if dogs are older and have not had the activity curbed in the past.
Shows of Dominance
Dogs will mount and hump to assert their dominance. You may even see spayed or neutered dogs attempting to mount other dogs, animals or even stuffed toys as a way to show who is boss. Even young dogs who have not yet reached sexual maturity may hump in this manner. Viewing the situation as cute, funny or harmless may only encourage what is essentially a behavioral problem. This can make it difficult to retrain your dog against the activity.
Dogs may hump their owners' legs, feet, laps or even the bodies of strangers for different purposes. They may be nervously humping in fear of separation or as an anxious or excited behavior. They may also be attempting to assert dominance over strangers or even their owners if they have not been properly trained and socialized.
Infection or Irritation
The sudden onset of humping behavior can signal your dog has an infection or irritation he is trying to relieve through repetitive motion or surface contact. If the behavior is new and is accompanied by a red or irritated groin area, consult your vet to check for urinary tract infection or other underlying medical issues.
A solid regime of traditional obedience training can help curb unwanted humping, or at least help you shorten instances of inappropriate humping, as your dog will get trained to follow your commands and see you as the pack leader. If training doesn't suffice, consult your vet. Your dog may be suffering from a treatable form of anxiety.