The storied comedian and actor Robin Williams had spent time at a rehab facility this summer to maintain his sobriety, his publicist said.