It is the social networking giant's biggest acquisition to date.
WhatsApp has more than 450 million monthly users and is popular with people looking to avoid text messaging charges.
In a statement announcing the deal, Facebook founder Mark Zuckerberg described WhatsApp's services as "incredibly valuable".
WhatsApp allows users to send messages over internet connections, avoiding text messaging fees. The company claims it is currently registering one million new users a day.
It makes money by charging users a subscription fee of $1 per year, although it offers a free model as well.
The deal to buy it includes $4bn in cash and approximately $12bn-worth of Facebook shares, plus an additional $3bn in stock to WhatsApp's founders and employees at a later date.
On a conference call to discuss the deal, WhatsApp co-founder Jan Koum said he planned to operate the firm "independently and autonomously". He will also become a member of Facebook's board of directors.
"We're excited and honoured to partner with Mark and Facebook as we continue to bring our product to more people around the world," Mr Koum said in a statement.
Mr Zuckerberg said the prospect of a deal was first floated just 11 days ago.
By Richard TaylorNorth America Technology Correspondent
That Facebook bought WhatsApp is less of a surprise than the sheer amount it has been willing to pay for it.
Some are seeing the $19bn price tag as further evidence of swollen valuations of companies as the sector experiences what may yet prove to be another dotcom bubble.
WhatsApp does give Mark Zuckerberg inroads into international markets and, as importantly, to a younger demographic. But what is less clear is whether the finances will add up in the long term.
WhatsApp has reiterated its commitment to an ad-free service, opting to charge users a mere $1 per year. Under this scenario, it will need to continue its growth trajectory to ensure any financial return to Facebook.
But Adverts are pivotal to Facebook's own business model - and the pressure for it to monetise its new WhatsApp user base in the same way may prove too tempting to resist.
The Facebook founder said he believed WhatsApp was on track to have a billion users, but insisted he had no plans to place advertising on WhatsApp's interface, saying he did not think ads were the best way to make money from messaging systems.
Once the deal is finalised, Mr Koum and co-founder Brian Acton are set to become Silicon Valley's newest billionaires.
WhatsApp has about 50 employees in total.
Cathy Boyle, a senior analyst at research firm eMarketer, said WhatsApp was valuable to Facebook for several reasons beyond advertising, including its younger user base and its popularity overseas.
"WhatsApp actually has greater penetration in a lot of international markets than Facebook," Ms Boyle told the BBC.
She added that it was notable that Facebook's chief financial officer David Ebersman referred to the telecommunications industry when discussing the firm's purchase.
"WhatsApp is trying to siphon the billions that the telecom industry would make from [traditional SMS text messaging]" she said.
Ben Bajarin, from California-based technology consultants Creative Strategies, told BBC Radio 4's Today programme that the deal would allow Facebook to tap into a rapidly growing market.
"WhatsApp is on a path towards a billion users," he said. "They're growing exponentially - much, much faster than Facebook.
"For Facebook this is a key growth area where, even if they don't monetise this product, this is a way that Facebook can get the next billion smartphone consumers into their ecosystem... to touch them and engage with them in other ways than just the Facebook platform."
Shares in Facebook dropped 5% in after hours trading before recovering slightly.
Prior to this acquisition, Facebook's biggest purchase had been Instagram for $1bn in 2012.
It had also reportedly offered $3bn to acquire photo messaging service Snapchat.
Facebook has bought messaging app WhatsApp in a deal worth a total of $19bn (£11.4bn) in cash and shares.