Passport is required for all overseas transits, including overseas transits on a domestic trip.
Therefore, if your Jakarta – Medan trip has a transit in Kuala Lumpur, you must have your passport with you.
Please make sure that your passport will still be valid at least 6 months after your flight schedule.