It wasn’t a death threat; it was a warning:
Leviticus 16:2 The Lord said to Moses, ‘Warn your brother, Aaron, not to enter the Most Holy Place behind the inner curtain whenever he chooses; if he does, he will die. For the Ark’s cover—the place of atonement—is there, and I myself am present in the cloud above the atonement cover.’
It’s similar to God’s response when Moses asked to see God’s glory.
The warning here was followed with a promise of redemption:
Leviticus 16:34 This is a permanent law for you, to purify the people of Israel from their sins, making them right with the Lord once each year.
The things Aaron and subsequent High Priests need to do in the Israelites’ day of atonement are described in some detail.