Johnstone, who played three tests in 2005, had already told his family and close friends before publicly coming out on current affairs programme Seven Sharp.
"If I can be the first All Black that comes out as gay and take away the pressure and stigma surrounding the issue it can actually help other people," Johnstone said.
"If I open up that door and magically make that closet disappear, then we're going to help a lot of people... "
"I pushed that side of me down deeper and deeper. I went to some interesting places."
Johnstone made his debut against Fiji and played two tests against the British and Irish Lions. He also made 62 appearances for Canterbury and 38 for the Crusaders.
New Zealand Rugby chief executive Mark Robinson, who is also a former team mate, said in a statement Johnstone's "strength and visibility will pave the way for others in our game".
"We know that there are people who have not always been comfortable to be who they are in rugby. We want to be clear, no matter who you love, rugby has your back," Robinson added.
New Zealand Sports Minister and former deputy Prime Minister Grant Robertson, who is gay, thanked Johnstone for "blazing this trail" and said his announcement was "a big moment".
"Another barrier has been broken. I hope it inspires future generations to be open, happy and comfortable," Robertson wrote on Instagram.
"There is still a long way to go, but feels a very significant step."