means that
someone endures serious hardships or dangers, often in pursuit of a goal or out of loyalty to another person.
same as
To go through thick and thin.
Imagine a case where to experience many difficulties or dangers; To face many challenges.; then “To go through fire and water” fits well.