It is legal as trading forex is how banks hedge risk for
importers and exporters. To learn about the legalities about
foreign exchange trading have a look at Compass Markets.
If the OP is referring to retail forex trading (with a retail
forex broker), the answer is tricky. It depends on how the law is
interpreted. From what I understand, it is illegal to operate an
actual retail brokerage within Malaysia, but you can trade within
the country with a broker located outside Malaysia.
This makes sense because if the legal environment was suitable,
all of the major brokers would already have full licenses in
malaysia, as they are one of the more stable SE Asian countries to
setup serious business in.