For the first time, the Food and Drug Administration has approved a digital pill — a medication embedded with a sensor that can tell doctors whether, and when, patients take their medicine.

The approval, announced late on Monday, marks a significant advance in the growing field of digital devices designed to monitor medicine-taking and to address the expensive, longstanding problem that millions of patients do not take drugs as prescribed.

Experts estimate that so-called nonadherence or noncompliance to medication costs about $100 billion a year, much of it because patients get sicker and need additional treatment or hospitalization.

“When patients don’t adhere to lifestyle or medications that are prescribed for them, there are really substantive consequences that are bad for the patient and very costly,” said Dr. William Shrank, chief medical officer of the health plan division at the University of Pittsburgh Medical Center.

Ameet Sarpatwari, an instructor in medicine at Harvard Medical School, said the digital pill “has the potential to improve public health,” especially for patients who want to take their medication but forget.

But, he added, “if used improperly, it could foster more mistrust instead of trust.”

Patients who agree to take the digital medication, a version of the antipsychotic Abilify, can sign consent forms allowing their doctors and up to four other people, including family members, to receive electronic data showing the date and time pills are ingested.

A smartphone app will let them block recipients anytime they change their mind. Although voluntary, the technology is still likely to prompt questions about privacy and whether patients might feel pressure to take medication in a form their doctors can monitor.

Dr. Peter Kramer, a psychiatrist and the author of “Listening to Prozac,” raised concerns about “packaging a medication with a tattletale.”

While ethical for “a fully competent patient who wants to lash him or herself to the mast,” he said, “‘digital drug’ sounds like a potentially coercive tool.”

Other companies are developing digital medication technologies, including another ingestible sensor and visual recognition technology capable of confirming whether a patient has placed a pill on the tongue and has swallowed it.

Not all will need regulatory clearance, and some are already being used or tested in patients with heart problems, stroke, H.I.V., diabetes and other conditions.

Because digital tools require effort, like using an app or wearing a patch, some experts said they might be most welcomed by older people who want help remembering to take pills and by people taking finite courses of medication, especially for illnesses like tuberculosis, in which nurses often observe patients taking medicine.

The technology could potentially be used to monitor whether post-surgical patients took too much opioid medication or clinical trial participants correctly took drugs being tested.

Insurers might eventually give patients incentives to use them, like discounts on copayments, said Dr. Eric Topol, director of Scripps Translational Science Institute, adding that ethical issues could arise if the technology was “so much incentivized that it almost is like coercion.”

Another controversial use might be requiring digital medicine as a condition for parole or releasing patients committed to psychiatric facilities.

Abilify is an arguably unusual choice for the first sensor-embedded medicine. It is prescribed to people with schizophrenia, bipolar disorder and, in conjunction with an antidepressant, major depressive disorder.

Many patients with these conditions do not take medication regularly, often with severe consequences. But symptoms of schizophrenia and related disorders can include paranoia and delusions, so some doctors and patients wonder how widely digital Abilify will be accepted.