The world’s largest retailer will take a 77% stake, valuing the Indian company at more than $20bn.
Flipkart has been under pressure from Amazon since it arrived in India five years ago.
Amazon had been considering making its own offer for the Indian firm, which has more than 100 million users.
Walmart has been looking to expand in India for years and is flush with cash from recent US tax cuts.
Founded in 2007, Flipkart has high-profile investors including Microsoft, Tencent and Softbank that will retain their stakes.
The combination with Walmart could be controversial, with concerns about how a deal might affect India’s smaller retailers.
Online sales in India were worth $21bn last year, according to market research firm Forrester.
That total is expected to soar in coming years as more of its 1.25 billion population makes more use of the internet.