Dietary needs differ significantly. While there may be some similarities since both animals are in the rodent family, what they need to much on all day is not exactly the same. Some selections, such as carrots, are the same. But others are very different. Also, the makeup of hamster food differs from that of guinea pig food. If both foods are available in the cage, there is no telling which each animal will pick. This could cause nutritional deficiencies, as well as overdoses or exposure to harmful food for either animal. Neither should eat the other's food. But they likely will, if available.
Territorial habits may cause difficulties. Both animals like to claim their space and do what they please with it. Many hamster breeds are extremely territorial. Most cannot even be housed with other hamsters due to this issue. Just imagine what they will think and do when something big (and possibly scary) moves into their house. It's not going to be very nice. Your hamster might simply hiss at the guinea pig and hide. The guinea pig may let out some squeaks of warning. On the other hand, either could react badly as well. Both animals like to kick and bite when they get upset, especially over their territories. While some may get along as playmates, it's not very common and they should never be left alone (and most likely, not even supervised) in the same confines.
Unfair match-up plays a role. Remember that guinea pigs are much larger than hamsters. Even though guinea pigs are more docile, the do still have sharp teeth. Neither of these animals is carnivorous. However, if your guinea pig is bitten by the hamster or otherwise threatened, there is no competition. A guinea pig's size immediately gives him the advantage. Housing hamsters and guinea pigs together is a very unfair mix. Take a look at your hamster's teeth. Yes, they are sharp. But also glance at your guinea pig's teeth. There should be no question at all who would win in a showdown.
Different cage needs can pose a problem. The bar spacing of hamster and guinea pig cages are not equal. Guinea pig cages have much wider spacing, from which hamsters can easily escape. They love climbing. Because of that, someone might opt to put both animals in a hamster cage instead. Think again. Hamster cages are not large enough for guinea pigs at all. On top of that, they are not built for guinea pigs, who may escape. What about a large aquarium? Even if you house these animals together in an aquarium or other cage that can contain both, there are still all of the other factors mentioned.
Varying behavioral instincts can spell trouble. Many hamsters are nocturnal creatures. This means they are active mostly at night and will be sleeping much of the day. Guinea pigs, on the other hand, are diurnal. This means that when your guinea pig is running around squeaking up a storm, it will interfere with your hamster's sleeping time. The same goes in reverse. It's doubtful the guinea pig will appreciate a hamster rooting around his area when he's trying to sleep. Also, each animal likes to keep special areas for everything in their cages. If these areas conflict (for instance, the hamster tries to store food where the guinea pig wants to sleep), that could create a serious problem.
*I originally published a version of this via Yahoo Contributor Network