Than when you come back from reservaist, you received a notice from them that you got sacked.
You mean you got a termination letter (directly), or was served notice first?
Yes, your boss can train your replacement in your absence -- although rather unethical of him -- but, under the law, he cannot sack you "immediately" unless it's for misconduct (must formally conduct an inquiry). Otherwise, the notice period, if it's not specified in your job contract, is usually 1-2 weeks (employed less than 5 years; I forgot the breakdown) or a month (5+ years). But only one day's notice is needed if you've only worked for less than 26 weeks.
If you think you're unfairly dismissed -- eg. your boss had approved your release for ICT in the first place, despite you being a newbie employee -- then, yes, you can seek legal recourse by appealing to MOM within one month of the sacking. They'll investigate &, if found guilty, your boss must either reinstate (& pay back lost wages) or compensate you. Don't be afraid either way: he'll have to show evidence to the ministry &, ultimately, their verdict shall be final & legally binding.