Both boards of directors have approved the transaction, which is expected to close in the fourth quarter of 2020.
"Data silos destroy great customer experiences," said Twilio co-founder and CEO Jeff Lawson.
"Segment lets developers and companies break down those silos and build a complete picture of their customer.
"Combined with Twilio's Customer Engagement Platform, we can create more personalised, timely and impactful engagement across customer service, marketing, analytics, product and sales. We are thrilled to welcome Segment to the Twilio team."
Segment's co-founder and CEO Peter Reinhardt said "Together, Twilio and Segment have an incredible opportunity to build the customer engagement platform of the future.
"We created Segment to help businesses set themselves apart in the digital age and deliver rich, connected customer experiences built on high-quality data.
"By joining forces and applying our customer data platform to Twilio's engagement cloud, we'll be able to make the entire customer experience seamless from end-to-end."