Is it safe to put a microwave in a walk-in closet?
There should be no problem assuming that you leave adequate clearance around the unit. Any appliance becomes a fire risk if there's flammable junk piled against it. 

Also be diligent about vacuuming up lint and dust. The microwave's cooling fan will draw in more debris in a clothes closet than it probably would in a kitchen. You might blow it out periodically with compressed air.