If you don't file under the FMLA and you have to be not at work, they absolutely can fire you for a medical emergency.
And since you're telling them it was a medical emergency, they can basically force you to tell them what it was. HIPAA does not apply to your employer. It does restrict your employer from giving anyone else Your health care information.
Whether one files for leave under FMLA or ADA or any other employer-specific policy never guarantees one's job is protected 100%. FMLA, by the way, requires the establishment of a Serious Health Condition. An overnight/admission to any type of hospital care would automatically qualify under these rules. Moreover, a health care professional need not provide - and Employers are not allowed to ask for - any more detail than is necessary to establish that a Serious Health Condition exists.
Outside of FMLA, if one is seeking leave as accommodation, an employee merely needs to advise Employer (usually HR vs. direct manager) of the need for leave due to a medical condition. Either a designated person/team from HR will provide paperwork to employee for health care provider to complete that asks for general information - again - defaulting to "employee will be hospitalized from x date to x date, or, even if they write out specifically something like "attending mental health out/in patient treatment program" is still fairly vague but helps establish the medical necessity of the employee not being able to be at work.
In these two instances, HR has very strict rules about disclosing any information regarding the employees' health or medial condition. Could an HR person tell the mananger? Of course. This would open the employer up to major legal liability not to mention probably cost that HR person his or her job.
And, neither of these workplace laws create a complete shield from punishment at work. If you fail to call in, disobey other rules such as stealing or going off on a customer/fellow employee, you can still be terminated for conduct related issues or basically anything that isn't related to the absence/leave. And, even then, employees can and often do still face some sort of blowback at work for taking time away -- even if no one knows the reason why. Fortunately, baltant acts by an employer such as denial of promotions or termination can be inferred under the law if taking place within around 6 months to a year from the return from said leave as being de facto retaliation, which is prohibted by both ADA and FMLA.
All this to say that in some instances, you may have to disclose to HR a generic reason for your leave. You never have to and should never be asked by your direct leader or even their leader for a specific diagnosis or condition that is requiring your leave. Both of these laws are meant to protect the employee so that he or she may attend to a Serious Health Condition or possibly take leave time as a reasonable accommodation to address a qualifying disability (this definition includes those recovering from addiction as well as the full spectrum of mental health conditions from ADHD to BiPolar).
An employee on an approved leave is still subject to normal employment actions -- again -- these aren't super shield get away with anything laws, but they do a very good job at ensuring employees are not harassed, demoted, terminated, or otherwise suffer negative consequences based solely on their need to take approved medical leave.