There's a long history of common currency in the British and ex-British territories and protectorates in SE Asia. In the 18th century, a wide variety of local currencies were used, with the Spanish dollar in common use for international trade, and also in local use. In 1826, the British introduced the Indian rupee as the official currency for the Straits Settlements (the actual British territories, consisting of Penang, Malacca, and Dinding on the Malayan Peninsula and Singapore just to the south; the other British areas were protectorates). The Indian rupee was chosen because the Straits Settlements were administered from India (they were former East India Company possessions). However, local international trade used the Spanish dollar, so the rupee was not useful for international trade. The British authorities plans to only use the rupee gave way to economic necessity, and in 1844 they began minting cents worth 1/100 of a Spanish dollar, and in 1867 minting dollars worth 1 Spanish dollar.
In 1898, they introduced the Straits dollar as a common currency for their territories (the Straits Settlements) and protectorates (the Federated Malay States, the Unfederated Malay States, British North Borneo, Brunei, and the Raj of Sarawak). The Straits dollar was worth 1 Spanish dollar. Sarawak still used its Sarawak dollar (introduced in 1858, before Sarawak became a British protectorate (in 1888)) alongside the Straits dollar; they were both worth 1 Spanish dollar.
In 1939, the Straits dollar was replaced by the Malayan dollar in all the territories that used it. The value was the same. Sarawak kept using the Sarawak dollar in parallel.
Malaya was still a patchwork of states, 4 of which had been joined together by the British to form the Federated Malay States in 1898 (when the Straits dollar was introduced), the others remaining the Unfederated Malay States and the three Straits Settlements peninsular territories. This would continue until after World War II. One of the Straits territories, Dinding, was handed back to the Malayan state of Perak to which it had originally belonged (before the British "persuaded" the sultan to transfer it to British control) in 1937.
After WWII, in 1946, the British joined the peninsular territories together to form the Malayan Union. The Malayan Union constitution was unpopular (especially among ethnic Malays), and the British tried again in 1948, with the Federation of Malaya. The Federation of Malaya became independent in 1957.
Sarawak saw political changes, too. After the defeat of Japan, Sarawak was administered by the British Military Administration, and then handed back to Rajah Charles Vyner Brooke in 1946. The economy of Sarawak had been badly damaged by the war, and the rajah almost immediately handed Sarawak over to the British, so that Britain would pay to rebuild the economy (and everything else).
In 1953, the British replaced the Malayan dollar with the Malaya and British Borneo dollar, of the same value. Since Sarawak was now a crown colony rather than a protectorate, it replaced the Sarawak dollar as well. When Malaya became independent, they kept using this newest dollar.
1963 saw another big political step: the formation of Malaysia, joining Singapore and the British territories and the Federation of Malaya into one country. Brunei, a protectorate rather than a British territory, didn't join. Singapore didn't last long as a state of Malaysia - they were expelled in 1965. Singapore became independent. Despite this expulsion, Singapore kept using the Malaya and British Borneo dollar. Brunei was still using it, too.
Thus, at this point, Malaysia, Singapore, and Brunei were using the same currency (as they had been for many, many years). This didn't last much longer. In 1967, all three countries issued their own currencies: the Malaysian ringgit, Singapore dollar and Brunei dollar, all worth the same as the preceding Malaya and British Borneo dollar. Along with the new currencies came the Currency Interchangeability Agreement which maintained all three at the same value.
This only continued for a few years: Malaysia opted out of the agreement in 1973, and the Malaysian ringgit went its own way. The answer to your question is simply that Singapore and Brunei stuck with the agreement, and continued their more-than-a-century of interchangeable currency (or the same currency).
At the time of writing, the Singapore dollar = the Brunei dollar = 3.10 Malaysian ringgit.
Further reading:
The above discussion of the politics of formation of Malaysia is simplified. For a glimpse of the fuller complexity of it all, here is a convenient graphic: https://commons.wikimedia.org/wiki/File:Malaysia_tree_diagram.svg