Which means you consent to the decisions of the majority.
There is no contractual agreement that you surrender your agency when you decide to vote.
Not casting a vote is a choice not to vote which is also a form of opinion.
Laws are imposed on people with or without their consent. At no point does a vote taking place confer that everyone consented.
Some law are unethical some are not, even if they are voted by a (super) majority.
But by living in a country, you consent to the laws of the country applying to you. That's the social contract you sign by being a citizen or resident in a country.
Your choice is to not live in that country or vote to change the specific laws that bother you.
Then all laws are consensual, and thus it's impossible for a law to be unjust.
That goes for anti-gay, anti-abortion and racist laws.
Another way to look at it is that you have an inherent right to live in your own country, without having to meet any conditions others impose on you. Thus you can choose to live in your own country and not consent to all laws.