The bahasa language was originally spoken in the regions around the Melakka straits but it gradually scattered all over Malaya and the various coastal areas of the islands of the Indonesian archipelago.
With the great variety of languages used by different peoples in the Indonesian archipelago and with the growing importance of trade and communication among them, the need for a lingua franca naturally arose, and the Malay language was "chosen" for several reasons:
1. The Malay language is quite easy to learn compared to other Indonesian languages. (There are, of course, many other Indonesian languages. Javanese, for example, has an extremely complicated grammatical structure and intricate systems of differentiation.)
2. The Kingdom of Sriwidjaja which dominated the region (Indonesia and possibly parts of the Philippines and Malaya) from 8th to 13th century was situated in a Malay-speaking region.
3. The areas in which the Malay language was first spoken were found on the coasts of Sumatra and the Malay peninsula, both bordering the Straits of Melacca which were, of course, the gateways to all the foreign trade going in and out the Indonesian archipelago.
Reference:
Nugroho, R. (1957) The origin and development of Bahasa Indonesia. PMLA, 72(2), 23-28.