In 1763, Richard Brooke received a patent for a tract of land located in the Province of Maryland. Originally known as Mechanicsville, the village which became Olney was established in 1800. The area was mostly farmland, but it soon began attracting artisans. Early residents Sarah Brooke and Dr. Charles Farquhar were devotees of the English poet William Cowper, and named their home after the poet's hometown of Olney in England. The area was later named for their home, which still stands and is known as the Olney House. In the town's center was a blacksmith, William Kelley's wheelwright shop, Canby's pottery factory, and a Benedict Duley's store.
The Brooke family held the largest tracts of land in Olney, whose central village was at the intersection of the Rockville to Baltimore road, and the one which connected Washington with Westminster, Maryland, to the north. The Quaker community in Sandy Spring thrived just to Olney's east. The Sandy Spring Museum is a historical museum featuring educational programs and displays. St. John's Episcopal Church was established in 1842 and survives to this day.
After the siege of Washington by the British in 1814 during the War of 1812, President Madison and his family passed through Olney en route to taking refuge in the neighboring town of Brookeville. Although not as involved in the Civil War as areas of Maryland to the west, Olney residents still experienced the tug-of-war between loyalty to the plantation economy of the South and to the Federal government in Maryland's midst. Both Union and Confederate forces made stops in Olney during the war. Union Generals George B. McClellan and Ambrose Burnside led soldiers through in the midst of the Maryland Campaign in 1862. During the Gettysburg Campaign in 1863, Confederate General J. E. B. Stuart marched between 10,000 to 20,000 troops north through the village and raided it of supplies, including horses and crops from surrounding farms in which they bivouacked.
As an unincorporated area, Olney's boundaries are not officially defined. The United States Census Bureau defines a census-designated place of Olney centered at 39°9' North and 77°5' West. It has a total area of 13.0 square miles (34 km2), all land.
Olney's town center sits at the intersection of state route 97 (Georgia Avenue) and route 108 (Olney-Laytonsville Road). The town, larger than any other in the neighboring areas, lies south of Brookeville, west of Sandy Spring, east-northeast of Gaithersburg, north-northeast of Rockville, and north of Aspen Hill.