Is it OK to have a gas water heater in a bedroom closet?
As stated, the room, itself, would have to meet codes for a bedroom (size, egress, etc.)

As for the water heater, it needs combustion air. If the room is smallish and making it a bedroom means it's going to be closed off, then you likely will need to convert the gas heater to either electric or to direct vent. The latter adds a blower that pulls in combustion air from outside. The con to that is that it may be noisy if in a closet.