The verse is taken from the Doctrine and Covenants 134.
There is a key phrase often overlooked in these verses. It is "whereby one religious society is fostered and another proscribed in its spiritual privileges, and the individual rights of its members, as citizens, denied."
You'll notice religious society as being the topic. In the case of Prop 8. This was not the case. Also, rights were not denied.
Here is a history of the section.
”Uphold the right, though fierce the fight,”
should be the motto of every Latter-day Saint.
-- Heber J. Grant, Conference, Oct. 1919
During a LDS Church conference in October, 1922, President Heber J. Grant got up and read D&C 134. He said, “I honestly believe that it will be for our best good to hear every word….” After reading the entire section, verse by verse, he stated the following:
Heber J. Grant, Conference Report, October 1922, p. 5
I endorse with all my heart this declaration sustained by the unanimous vote of the general conference in 1835.
I am convinced beyond the shadow of a doubt that it is the duty of every Latter-day Saint to sustain and live the law. I believe that every Latter-day Saint who has any idea in his or her heart that some law has been passed that is not a righteous law, after it has been fought out in the courts and has been decided, whatever the decision may be, by the highest tribunal of our great and glorious country, the Supreme Court of the United States, that it is his [or her] duty to obey such law.
There are such things as “bad” laws. Can LDS Church members be involved in changing them, and how should they do so? The answer is a resounding “yes.” Refer to the first paragraph of this history for an answer to the question on “how.” Even so, it is generally our duty to obey the law, especially if that law has been through the courts. Study verses 1-9 for a full understanding.
We believe in being loyal citizens. We believe in solving problems through legal means. We uphold the law, but will work hard to correct bad or inadequate laws.