One reason someone would tell you this is because you 'need to know', particularly if you have to be prepared to mop up something left by the now departed colleague. This could be backing up a server or changing locks on a door or securing a storage area - who knows. It might also be necessary for you to take over a customer relationship that the other party has, you might need to know this if the customer calls.
If your boss provided an explanation, it's quite possible you're being invited to drop a hint: for your colleague to clean up his/her act. Since you haven't indicated whether it was a performance issue or a resources issue (i.e., a layoff due to cutbacks) it's hard to tell why this is being done. Realistically, dropping hints to people that they're not performing is useless - it isn't likely to affect behavior, other than to, perhaps, give them an opportunity to mess something up on their way out.
If your boss was engaging in somewhat of a dirty trick, he might have you tell your co-worker that he's being fired in order to wreck his morale, triggering even more performance issues. This seems rather dangerous, and if this is what your boss was doing, he wouldn't answer your question in so many words.