Their sufferings were for their rebellion against (Psa 105:28) the words, or purposes, or promises, of God for their benefit. When humbled they cry to God, who delivers them from bondage, described as a dark dungeon with doors and bars of metal, in which they are bound in iron - that is, chains and fetters.
shadow of death - darkness with danger (Psa 23:4).