“There are enormous ethical and legal concerns,” said Lawrence Gostin, a Georgetown University law professor who specializes in public health. “Patients across America should be very worried that their medical records are going to be used in ways that harm them and their families.”

Officials at the Centers for Medicare and Medicaid Services, in charge of maintaining the system, have said patients will need to opt in for the sharing of their medical records and data, which will be kept secure.

Officials say patients will benefit from a system that lets them quickly call up their own records without the hallmark difficulties, such as requiring the use of fax machines to share documents, that have prevented them from doing so in the past.

“We have the tools and information available now to empower patients to improve their outcomes and their healthcare experience,” Dr. Mehmet Oz, the administrator for CMS, said in a statement Wednesday.