Yes, a tourist visiting CA can get a doctors recommendation. However, not every dispensary will accept your business without a CA ID. There are others that will however. Usually delivery services are more flexible with this rule. There is nothing in CA law that determines this.
mark