Employer-matched contributions to a 401k should be prioritized before an emergency fund. Otherwise you are leaving free money on the table. This applies to many Americans.
You borrow from the 401K. If for some reason that's not an option, you take money out with a penalty, but with sufficient match you are still often ahead.