The characters combine literally to mean: “In adversity (患) and hardship (难), one sees (见) true (真) feelings (情).” The structure powerfully conveys that hardship acts as a lens through which authenticity is revealed.
The focus is on the *revelation* of true character, which is a slightly different emphasis than the *action* of being a friend in need.
This idiom is common in both spoken and written Chinese. It's not casual slang but is well-understood by everyone. It often carries a serious, heartfelt tone.