PillPack, which delivers medications in pre-sorted dose packages and employs more than 700, also has offices in Manchester, N.H. The company had previously been rumored to have been in talks with Walmart.
"PillPack's visionary team has a combination of deep pharmacy experience and a focus on technology", said Jeff Wilke, Amazon CEO Worldwide Consumer.
The deal is expected to close during the second half of 2018 and is subject to customary closing conditions.
Amazon's purchase of an online chemist that opens an immediate nationwide drug network in the United States has shaved billions off the value of three major pharmacy chains.
PillPack delivers prescription drugs to customers' doors.
Amazon.com Inc. is buying its way into the heart of the US health-care system, instantly shaking up a prescription-drug industry already in the midst of a broader transformation.
Amazon will pay about $1 billion for Boston-based PillPack, according to a person familiar with the matter.
Amazon did not disclose the terms of the PillPack acquisition.
Shares in Walgreens Boots Alliance - which owns Boots in the United Kingdom, and CVS Health and Rite Aid were sent tumbling on Thursday afternoon, wiping $12.8bn (£9.7bn) off their combined market value. In February, the grocery chain Albertsons Cos. said it would buy Rite Aid in an effort to hold off Amazon.
The deal could give Amazon another major foothold in New England, where it has made several major acquisitions and investments in recent years. CVS Health, Walgreens and Express Scripts Holding opened down on the news.
Some analysts played down the immediate threat Amazon poses.
The selloff in drugstore stocks on Wednesday was reminiscent of the food-industry swoon that resulted in June 2017 when Amazon said it was buying Whole Foods Market Inc.
The company's backers include Accel Partners, Atlas Venture, CRV, Founder Collective, Menlo Ventures, Sherpa Ventures and Techstars.
A September 2016 funding round valued the startup at around $360 million, according to venture-capital database PitchBook.