The trope of a group being trapped in a house or single location is a common theme in horror that has been explored in various forms. Horror movies or stories where a group is trapped in a house, a hospital, a mall, or any number of locations is ripe for storytelling.
In some cases, it is merely a budgetary reason. Low budget horror can spend more money on special FX if it can limit the locations they have to film in. The idea of a group being trapped also creates a lot of narrative avenues for horror. In addition, at this point it has become a tradition that many storytellers use because it is mimics some of the classics of the genre, from Night of the Living Dead (1968) to The Haunting (1963).
And of course, horror movies like Cabin in the Woods (2011) use this trope and spin it on its head.