She nearly drowned.

Literal

She [topic-は] narrowly drown-die [was-about-to-ところだった].

Two pieces drive the 'narrow miss' meaning. 危うく ('narrowly, by a hair') is an adverb specifically for close calls, almost always paired with a near-disaster. ~ところだった ('was on the verge of, was just about to') closes the narrow miss by saying the bad outcome didn't actually happen — it was very nearly the case. The combination 危うく + Verb + ところだった is the canonical 'almost X-ed' construction. 溺死する ('to drown to death') is a heavier word choice than the simple 溺れる ('drown'), reinforcing how dangerous the situation was.