There is no "right" time to visit Malaysia. As with Singapore, visitors to Malaysia should expect some rain whenever they go.
There are however certain areas that are particularly wet at times and best avoided then. The eastern coast of Peninsular Malaysia is best avoided during the northeast monsoon from November to March. This is the case partly because it will be heaving with rain a lot of the time and there may be flash floods, but also because most, if not all the accommodation on the Perhentian Islands, along with the other east coast islands, will be closed due to bad weather and rough seas.
Sticking with the peninsula, the northern part of the west coast of Peninsular Malaysia (Penang and Langkawi) can get quite a bit of rain in September and October. This is less of an issue in Penang, where a rainstorm is just a good excuse to eat more, than in Langkawi where visibility for diving is badly affected.
Another area best avoided is Sabah and Sarawak in January when the rain, even by Borneo standards, is torrential.
The best time to visit the east coast of the peninsula is from April or May to October, when you can expect calm waters and clear blue skies (most of the time).