The setting in Emma is important to the novel as it represents a microcosm of society at the time. Each social class from the landed gentry (Mr Knightley) to the poor have their place.
The relationship between Emma and Harriet begins due to the distance between Emma's home, Hartfield, and that of her former governess and confidante Mrs Weston, Randalls. As a married woman, Mrs Weston can no longer visit Emma so frequently, and so Harriet, who is poor and values Emma's friendship because of this, takes her place.
The setting also links to a cause of conflict in their relationship and its eventual solution. Mr Robert Martin of Abbey Mill Farm proposes to Harriet and is rejected, under Emma's influence, as she tells Harriet:
"The yeomanry are precisely the order of people with whom I feel I can have nothing to do."
This is Emma's snobbery at work. The link between Mr Martin and Mr Knightley (owner of Donwell Abbey and the farm) indicates that, when Emma matures and marries Mr Knightley, the relationship between Harriet and herself can continue.