SAN FRANCISCO—Americans across the country voted Tuesday for the right to inhale without going to jail, legalizing recreational marijuana in four states, and medical marijuana in three others.

In California, where medical marijuana is already legal, voters approved recreational pot, a major coup for backers of pot legalization.

The new laws...