A cat can be very particular about potty issues. Missing the box can be caused by a variety of health and/or behavioral factors, and is not a deliberate act on the part of the animal. To correct the problem, it's important to examine the cat's physical and emotional health, as well as its instinctive behavior traits when trying to figure out why your cat is pooping outside the box.
The HISS Analysis
The HISS Test is one method of analyzing the various factors that can contribute to cat behavior.
HISS is an acronym that stands for health, instinct, stress, and symptom-solvers, and looking at each factor can help you narrow down the causes of this and other feline problems.
Cats with health issues such as constipation can decide to "blame the litter box" and find other places to relieve themselves. An older cat may also have problems with arthritis that makes it difficult to get in and out of the boxes, or to pose appropriately. Cats that do use the box for urination but refuse to use it for the other function usually have a health issue causing the problem.
Many cats prefer to have one different box for solids and another for liquids. Other times, they just don't want to share the facilities. This is why the 1+1 litter box rule—one box per cat, plus one extra—is generally recommended. So with two cats, ideally three litter boxes should be available.
Cats are by nature emotional creatures.
It's wonderful if your cat gets along with his cat buddy, but there may be stress issues at work that are not obvious.
Cats that have been recently adopted often take a few weeks or months to settle in and feel comfortable enough to reveal their personality and foibles. It may be that your cat was still feeling a bit uncertain at first, and was willing to share the litter box.
But after two months he decided to make a statement—on the rug.
Removing the rug and adding a litter box is a good move. Bathroom rugs seem to be common targets for some reason. Many of the bath mats have a plastic/rubberized backing that seems to smell like urine to the cat, drawing them to these areas.
Second, while the two litter boxes are a wonderful solution, they need to be in two totally different places. Otherwise, one cat can "guard" and own both toilets and keep the other away.
Finally, take a look at the surface on which your cat prefers to defecate, and try duplicating that surface. For instance, if he likes tile, leave the bottom of the litter box bare. If he's targeting paper, line the bottom of the box with paper; or if he targets carpet, then provide a carpet remnant.
A very large box or one with lower sides may be more appealing if he's having difficulty maneuvering in the existing facilities.