Is it okay for military personnel to use marijuana recreationally in a state where it is legalized?

The fact that your state has decriminalized marijuana use is not relevant to military law. The military is a federal institution, governed by federal laws. Drug use is a crime under the Uniform Code of Military Justice (UCMJ) Article 112a, 10 U.S.C. 912a. Further, there is no "off time" for service members when it comes to drug use, nor does the law vary depending on location or even the dominant public perception of the drug use (whatever it may be).

Members serving in the reserves or national guard sometimes (falsely) believe that their “legally” allowed use (by having a doctor’s authorization) somehow makes marijuana use acceptable when not on duty. But since THC from marijuana stays in the system for 35 days, and there will be a minimum of one annual drug test (with at least one more likely surprise test), the odds are that most military marijuana users---even though perhaps following state law---will eventually be caught.

There is simply no allowance to use ‘medical marijuana’ in military service. There are also likely to be severe repercussions if marijuana, belonging to someone else legally, is found in the possession of a service member…as has happened when (for example) the spouse of a service member has placed medically prescribed (legal) marijuana in their vehicle, only to have it discovered by base guards.

The end result to any of these situations is very possibly a bad conduct discharge from service. The best case scenario tends to be an administrative discharge rather than a full-blown court-martial, but that is only for those cases resolved purely by urinalysis and in which no behavioral issues or other violations or infractions occurred. The bottom line is that military regulations allow punishment of military personnel under the Uniform Code of Military Justice for actions that bring the service into disrepute, regardless of the local legality of those actions.