WASHINGTON—Vice President Joe Biden’s son Hunter was discharged from the Navy Reserve this year after testing positive for cocaine, according to people familiar with the matter.

Hunter Biden, a lawyer by training who is now a managing partner at an investment company, had been commissioned as an ensign in the Navy Reserve, a part-time position. But after failing a drug test last year, his brief military career ended.

Mr. Biden, 44 years old, decided to pursue military service relatively late, beginning the direct-commission process to become a public-affairs officer in the Navy Reserve in 2012. Because of his age—43 when he was to be commissioned—he needed a waiver to join the Navy. He received a second Navy waiver because of a drug-related incident when he was a young man, according to people familiar with the matter. Military officials say such drug waivers aren’t uncommon.

Mr. Biden was commissioned as an ensign on May 7, 2013, and assigned to Navy Public Affairs Support Element East in Norfolk, Va., a reserve unit, according to the Navy. In June 2013, after reporting to his unit in Norfolk, he was given a drug test, which turned up positive for cocaine, according to people familiar with the situation. Mr. Biden was discharged in February, the Navy said.

Mr. Biden said in a statement that it was “the honor of my life to serve in the U.S. Navy, and I deeply regret and am embarrassed that my actions led to my administrative discharge. I respect the Navy’s decision. With the love and support of my family, I’m moving forward.”