In order to get out of the pits, you need to make sure you haven't dug any pits for others. Psalms tells us, -16
Behold, the wicked brings forth iniquity; yes, he conceives trouble and brings forth falsehood. He made a pit and dug it out, and has fallen into the ditch which he made. His trouble shall return upon his own head, and his violent dealing shall come down on his own crown.
Then there is Psalm -16,
The nations have sunk down in the pit which they made; in the net which they hid, their own foot is caught. The LORD is known by the judgment He executes; the wicked is snared in the work of his own hands.
Finally, Psalm 57:6,
They have prepared a net for my steps; my soul is bowed down; they have dug a pit before me; into the midst of it they themselves have fallen.
When people dig a pit for somebody else, they end up falling into it themselves. In fact, Proverbs 26:27 says it most directly,
Whoever digs a pit will fall into it, and he who rolls a stone will have it roll back on him.
Pretty plain, isn't it? If you are asking God to get you out of a pit, you need to take time to consider if it is a pit of your own construction. If you have done something to get someone else in trouble—even if you think you are justified in doing it because that person has hurt you—you need to repent. Until there is repentance, God will not intervene.
God is not going to get you out of your pit while you have a shovel in your hand.