MADISON, Wis. — The State Assembly on Friday approved legislation barring unions from requiring workers to pay the equivalent of dues, leaving Wisconsin poised to become the 25th state with what advocates describe as a right-to-work law.

Gov. Scott Walker, who said before he was re-elected to a second term in November that he did not expect right-to-work legislation to be taken up this session, has since said that he will sign the measure within days. The move was expected to burnish Mr. Walker’s image as a conservative willing to take on unions as he flirts with a run for the Republican nomination for president.

It also further shifts the climate in the Midwest when it comes to unions. Wisconsin’s action follows similar moves in recent years by Indiana and Michigan. Gov. Bruce Rauner of Illinois said last month that he would end a requirement that all state workers pay the equivalent of dues, and on Thursday, labor unions filed a lawsuit seeking to invalidate his action.