Every American patient has a legal right to access their own medical records. The federal law is called “HIPAA”(Health Insurance Portability and Accountability Act of 1996) which is United States legislation that provides data privacy and security provisions for safeguarding medical information. How to navigate HIPAA is described here in laymen’s terms. Here is a PDF that you can print which summarizes what your rights are under HIPAA Law.
Each medical entity (hospital, clinic, individual medical provider) that has treated you as a patient has a legal obligation under HIPAA Law to both preserve your medical records, and make them accessible to you as their patient. You can contact them in writing to obtain a copy for yourself (usually for a fee,) or sign a “Consent to Release” form to have them sent from a prior provider to a new one.
Since each medical provider uses a different record keeping method, there is no single clearinghouse that contains the totality of your medical records. If that is what you need, you will need to contact each entity at which you were a patient.
Regarding how an ER obtains your medical information and records, this occurs through what medical professionals call “doc-to-doc” exchange: “the HIPAA Privacy Rule permits a health care provider to disclose protected health information about an individual, without the individual’s authorization, to another health care provider for that provider’s treatment of the individual.” hhs.gov
There is no specific service I am aware of which can do the work of collecting your health records for you, other than perhaps your lawyer.