We are commanded to spread the Gospel. That alone will change hearts, not passing laws.
But it's also true that bad laws do change hearts, and in the wrong way.
It's also true that there's such a thing as objective moral truth (also called "natural law"), and civil laws ought to correspond to that objective moral truth unless there's a very, very good reason not to in specific cases. (For example, because the government is sufficiently corrupt that it can't be trusted with the additional power.)
Why? Well, for one thing, correspondence to objective truth ("reality") is the definition of sanity. Laws permitting, e.g., abortion are literally insane, and it's insane not to oppose them.
Don't forget the "community effects". Laws that permit (or worse, encourage) bad things mean that you and your family have to live in a society where those bad things are tolerated. Straight from scripture: "Bad company corrupts good morals." Well, a society that legislates bad things is "bad company".
Finally, God judges nations as well as individuals. Much of the Old Testament was written to tell that story.