Many raised in the church have developed an automatic, Pavlovian response to variants of the phrase:
Every man did what seemed right in his own eyes.
Our automatic response is to associate this concept with evil. And this view is not necessarily inaccurate, but then again, it's not entirely accurate either.
The phrase, or something like it, is found in several places within the Bible, and it means different things in different contexts.
For example, in Deuteronomy 12:8 (HCSB), we read:
You are not to do as we are doing here today; everyone [is doing] whatever seems right in his own eyes.
The context here is that Moses is giving instructions to the Israelites as to how they are to worship YHWH. Currently, everyone is doing their own thing, but he makes it clear that as of that point in time, there are certain prescribed rituals and ways of doing things when Israel worships God.
Proverbs 12:15 (HCSB) says:
A fool's way is right in his own eyes,
but whoever listens to counsel is wise.
Here, the Pavlovian response is justified. The meaning is clear that it is foolish to trust one's own understandings and wants when making choices.
This same warning is echoed in Proverbs 16:2 (HCSB), which says:
All a man's ways seem right in his own eyes,
but YHWH weighs the motives.
Although the warning is echoed here, there's also another message you can see if you read between the lines: People act according to their inner beliefs. In other words, "I wouldn't act this way if I didn't believe it's right for me to do so". (Granted, people often act in opposition to what they believe to be right, but at their very core, they believe what they're doing is "right for them".)
Perhaps the most recognized variant of this phrase comes from Judges 17:6 (ESV):
In those days there was no king in Israel. Everyone did what was right in his own eyes.
But this is also the passage that is probably most taken out of context.
This passage is not saying that the people then were living wild and having orgies and stealing from their neighbors and killing strangers for fun, and should not be so applied.
Instead, this passage is giving us the ideal form of human government: control of one's self according to a Godly mindset.
Now, I don't know that the people were fulfilling this ideal; I suspect, humans being the selfish creatures we are, that those people were not living according to a completely-given-over-to-God mindset. But that's the ideal.
Notice that the contrast in this passage is not between ungodly and Godly living: it's between a monarchical governmental system vs an individual-oriented system.
Imagine that in a perfect world everyone was Godly, and lived by the Golden Rule of treating others as you would want to be treated. In such a world, there would be no need for a sheriff, or a Congress, or a standing army, or a President, or a King, or any other of the trappings of "government". The ultimate, and only real, purpose of government is to make sure one person does not mistreat others. From the establishment of property boundaries, to the control of traffic lights, to the oversight of the radio spectrum, the proper role of government is simply to make sure that I don't fudge land from you by moving property markers, to make sure that I don't kill your family by running a red light, to make sure that I don't broadcast my radio station and silence yours with a jamming signal.
This sort of self-rule is easier in a smaller population, but if everyone were to adopt a God-mindset, it would work in any size population.
This is the ideal Kingdom of God. When all the citizens of the Kingdom fully submit to God, then we'll have no more need of man-made governments: we will need no king in Israel, for we will all do what is right in our own God-focused eyes.