expression
personally; firsthand; through one's own experience
Emphasizes direct personal involvement, often with one's body or actions. Used to convey that something is learned or understood by doing it oneself.
彼は身をもってその危険を体験した。
He experienced the danger firsthand.
身をもって教えることが一番効果的だ。
Teaching through personal example is the most effective.
expression
Used with verbs like 逃れる (escape) or 免れる (avoid) to mean escaping by a very small margin. Often implies a close call.
彼は身をもって難を逃れた。
He barely escaped the danger.
自ら also means 'personally' or 'oneself', but is more formal and often used for voluntary actions, while 身をもって emphasizes learning or experiencing through one's own body or direct involvement.
辛うじて means 'barely' or 'just barely' and is a more common adverb for narrow escapes, whereas 身をもって in this sense is a set phrase used with specific verbs like 逃れる.
The phrase combines 身 (body, oneself) with をもって (by means of), literally 'with one's body'. The second sense of 'barely' likely developed from the idea of escaping with only one's body intact.