Amazon.com Inc. and Indonesian ride-hailing startup Gojek Group have held preliminary talks on a partnership, according to people familiar with the matter, which could expand the online retail giant’s services into a populous new market.

The companies have discussed an arrangement by which Amazon would make a sizable investment in Gojek and tap into the Jakarta-based company’s delivery infrastructure in Indonesia, one of the people said.

An...