The village of Longbourn was only one mile from Meryton; a most convenient distance for the young ladies, who were usually tempted thither three or four times a week, to pay their duty to their aunt and to a milliner’s shop just over the way. The two youngest of the family, Catherine and Lydia, were particularly frequent in these attentions; their minds were more vacant than their sisters’, and when nothing better offered, a walk to Meryton was necessary to amuse their morning hours and furnish conversation for the evening. . . . At present, indeed, they were well supplied both with news and happiness by the recent arrival of a militia regiment in the neighbourhood; it was to remain the whole winter, and Meryton was the headquarters. 

With little to occupy them at their home in rural England, the Bennet sisters frequently walk to the nearby village of Meryton to visit family, gather news, and flirt with the officers stationed there. The presence of a regiment of officers suggests the story is set during the Napoleonic Wars. More importantly than setting Pride and Prejudice in a specific time period, the officers serve several purposes in the novel. Their presence offers families like the Bennets a chance to search out “respectable” suitors. The plentitude of officers makes the social gatherings more exciting for the Bennet sisters. Wickham’s responsibilities as a soldier are mentioned as a likely reason he doesn’t attend the ball at Netherfield, although the real reason ultimately revealed is Darcy’s attendance there.