Walmart Inc. is stopping ammunition sales for assault-style rifles and handguns, further restricting the retailer’s gun-related sales and policies after two deadly shootings at its stores last month.

Recent mass shootings have raised pressure on retailers and policy makers to take steps to reduce gun violence. Walmart’s ammunition changes exceed the measures taken by other big retailers that have tightened their gun policies in recent years after other deadly shootings.

Lawmakers...