Internet-connected cars will improve in-car entertainment, and be able to help with crash alerts and diagnosing engine problems.
It will also be key for driverless technology.
Samsung said automotive electronics was "a strategic priority".
The deal is the biggest overseas purchase made by a South Korean firm, and comes as Samsung is looking to recover from the withdrawal of its Galaxy Note 7 smartphone.
It is estimated that the so-called connected technologies market, which goes under the Internet of Things umbrella, will grow to $100bn by 2025.
Cars will be a major part of this growth, with technology research firm Gartner forecasting that by 2020 one in five vehicles will have some sort of wireless network connection.
Features being working on include in-car monitors assessing drivers' health as they travel, and automatic leaving and arriving alerts for friends and family. However, campaigners have highlighted potential data privacy issues around connected vehicles.
"The vehicle of tomorrow will be transformed by smart technology and connectivity in the same way that simple feature phones have become sophisticated smart devices over the past decade," Young Sohn, Samsung's president and chief strategy officer, said in a statement.
The purchase comes in the wake of the Galaxy Note 7 episode, which saw both Samsung's reputation and profits harmed after it was forced to recall, then end production of the device, because it turned out to be a fire hazard.
Samsung generates the bulk of its revenues from its smartphone business, but is now looking for new areas of growth.
Last year, it created a business division focused on automotive electronics and recently invested in a Chinese carmaker, BYD.
Harman, which has its headquarters in Connecticut, makes products that are used in more than 30 million vehicles.
The deal is expected to be completed in mid-2017. Harman's chief executive, Dinesh Paliwal, will continue to run the company.
Samsung Electronics is buying automotive electronics-maker Harman International Industries for $8bn (£6.4bn), as it makes a big push into connected car technologies.