As an addendum to naruto's post, Shogakukan's 国語{こくご}大{だい}辞典{じてん} notes that this term comes from the esoteric Onmyōdō religion, a kind of syncretion of the beliefs and practices of native Japanese Shintō combined with Taoist ideas from China and also Buddhism. This religion was prohibited as superstition in the Meiji period, so terminology specific to Onmyōdō has fallen out of common use -- hence naruto's comment that this 方{かた}忌{い}み word is rare.
Part of Onmyōdō practice has to do with the directions in which things face, be it north, south, etc. One key paragraph from the Wikipedia article, in relation to 方忌み:
During the Heian period the nobility organized their lives around practices recommended by onmyōji. The practice of "lucky and unlucky directions" provides an example. Depending on the season, time of day, and other circumstances, a particular direction might be bad luck for an individual. If one's house was located in that direction, such an individual was advised not to go back directly to his house but had to "change direction" (方違え, katatagae), by going in a different direction and lodging there. Such a person would not dare to go in the forbidden direction, but stayed where they were, even if that resulted in absence from the court, or passing up invitations from influential people.