Wal-Mart said on Tuesday it aims to name new leadership for those businesses by the end of January, after which Castro-Wright will assist in the transition.
Castro-Wright moved to California last year from Wal-Mart's home town of Bentonville, Arkansas to be with his wife, who had a heart transplant.
His retirement will allow him to spend more time with his family, Wal-Mart said.
The departure comes some six weeks after Wal-Mart said it was shaking up its e-commerce structure as it aims to build up its online business. Wal-Mart has had a Web presence for years, but still lags behind competitors such as Amazon.com Inc <AMZN.O> in terms of recognition.
Castro-Wright joined Wal-Mart in 2001 as chief operating officer of its business in Mexico. He was named president and chief executive of Wal-Mart U.S. in 2005 and took on his current position in August 2010.
In another Wal-Mart departure announced on Tuesday, Nestle <NESN.VX> named Wal-Mart's executive vice president of global e-commerce for emerging markets as its new chief financial officer. Wang Ling Martello, who has also worked with Kraft Foods Inc <KFT.N>, will join Nestle on April 1.
Wal-Mart shares closed up 20 cents, or 0.4 percent, at $52.03 on the New York Stock Exchange.
(Reporting by Martinne Geller; Editing by Richard Chang, Bernard Orr)