The company said in its statement that it made the decision in light of recent events and will try to implement this change "as quickly as possible."
Walmart also pointed out that in 2015 it ended sales of certain sporting rifles like the AR-15. The company also said it doesn't sell accessories like bump stocks or high-capacity magazines.
It also said it is removing items resembling assault-style rifles like toys from its website.
These announcements come after a gunman wielding an AR-15 semi-automatic rifle killed 17 students at a Florida high school earlier this month.
On Wednesday, President Donald Trump met with a bipartisan group of lawmakers to discuss school and community safety. The president has said that he is in favor of raising the federal minimum age to buy guns to 21 from 18 — a policy staunchly opposed by the National Rifle Association. Trump has also said that he supports stronger background checks which would focus more on mental health.
Read Walmart's full statement below:
In light of recent events, we've taken an opportunity to review our policy on firearm sales. Going forward, we are raising the age restriction for purchase of firearms and ammunition to 21 years of age. We will update our processes as quickly as possible to implement this change.
In 2015, Walmart ended sales of modern sporting rifles, including the AR-15. We also do not sell handguns, except in Alaska where we feel we should continue to offer them to our customers. Additionally, we do not sell bump stocks, high-capacity magazines and similar accessories. We have a process to monitor our eCommerce marketplace and ensure our policies are applied.
We take seriously our obligation to be a responsible seller of firearms and go beyond Federal law by requiring customers to pass a background check before purchasing any firearm. The law would allow the sale of a firearm if no response to a background check request has been received within three business days, but our policy prohibits the sale until an approval is given.
We are also removing items from our website resembling assault-style rifles, including nonlethal airsoft guns and toys. Our heritage as a company has always been in serving sportsmen and hunters, and we will continue to do so in a responsible way.
— CNBC's Kevin Breuninger contributed to this report.
Correction: This story has been updated to reflect that Walmart will remove items resembling assault-style rifles from its website. An earlier version mischaracterized what kind of items would be removed.