BEND, Ore.—Oregon is emerging as a testing ground for a new approach to solving the nationwide shortage of affordable housing.

The state legislature in June passed a zoning law requiring cities of 25,000 people or more to allow two-, three- and four-unit residential buildings in neighborhoods of single-family homes.

New construction frees...