Twitter Inc. may be contemplating a future in the hands of an acquirer after a yearslong effort to sharpen its focus and ignite user growth has fallen short.

Salesforce.com Inc. is considering a takeover of the social media company, according to people familiar with the matter. The exploration is in early stages, one of the people said, and might not lead to a deal.

Shares...