"When piety is calumniated in the world, the saints will stand up in its defense; they will wipe the dust of a reproach off the face of religion. Holiness defends the godly, and they will defend holiness; it defends them from danger, and they will defend it from disgrace." —Thomas Watson
In this verse, the psalmist is using the testimonies of God in a practical way: he is speaking them. It is important to read the Bible, to study it and to memorize, but we also have an obligation to speak of it. We cannot keep it to ourselves.
To whom are we to speak these words? All lost sinners need to hear it, but here there is a specific audience: "before kings". This can be expanded to anyone in authority over us—whether a President, a governor, or someone like a boss or a teacher. The Bible has a lot to say about how we should interact with authorities. Certainly, we cannot shout at them, and wave our Bibles in their faces. (In fact, this is hardly the best course of action with anyone, let alone someone in a position of authority.) We need to be respectful, and obedient, but when it comes to God's words, we cannot back down.
But sanctify the Lord God in your hearts, and always be ready to give a defense to everyone who asks you a reason for the hope that is in you, with meekness and fear. 1 Peter 3:15
We are blessed, in this country, with remarkable freedom to speak of our faith. It is not surprising that governments through the ages have sought to reign in Christianity; governments by their very nature are trying to organize and control people, and ideas—especially a Big Idea like Christianity—make people difficult to control.
However, kings and rulers still need the gospel. Just like all men, they are sinners and separated from God. As leaders and teachers of the people they rule, they are even under a stricter judgment for their decisions and actions (James 3:1). God is the One who gave rulers their power, and if they are wise they will be careful to exercise it according to His will.
He who rules over men must be just, Ruling in the fear of God. 2 Sam 23:3
By me kings reign, And rulers decree justice. Proverbs 8:15
We know, then that we should speak God's testimonies before kings, and the author also addresses what our attitude should be as we do so: we should not be ashamed. It is far too easy to feel uncomfortable or ashamed when our convictions are made evident in unsympathetic company, but we should not be! God's testimonies are nothing to be ashamed of.
Instead we should be proud of God and His word: it is true, and lovely, more noble by far than any person on earth. Let us pray that if we are ever called to uphold God's truth, He will give us the words to speak, as Jesus promised in Matthew 10:19-20.
Remember also that, "the king's heart is in the hand of the Lord" (Prov. 21:1). Man can do nothing to us unless it is God's will.