Dr Gallop, a Rhodes scholar who holds a doctorate from Oxford university, is less than a year into his second term as WA leader.
He told journalists in Perth that he advised cabinet of his resignation after returning
from leave, and that he sought advice from doctors about his illness last week.
"Living with depression is a very debilitating experience which affects different people in different ways," he said.
"My doctors advise me that with treatment, time and rest, this illness is very curable.
"However, I cannot be certain how long (it will take)."
WA Treasurer Eric Ripper, who was acting premier while Dr Gallop was on leave, will continue in the position.
Federal Opposition leader Kim Beazley has paid tribute to Dr Gallop, whom he said he counts as a close friend, and said the state has flourished under his leadership.
"He has been a brilliant and innovative premier presiding over Western Australia's most dynamic economy," said Mr Beazley.
"He leaves our State a far better place than he found it."
Dr Gallop said his condition has placed enormous pressure on his family, and while he has always been committed to politics, his health must come first.
"What has made this announcement all the more difficult today is that I love being premier, I love the work, I love the state, and I love its people," he said.
Dr Gallop's family members and cabinet colleagues were by his side as he announced his resignation.
He refused to take questions, and said he would not do any further media interviews.
Dr Gallop was first elected WA premier on February 10, 2001, unseating the Liberal government of Richard Court, and was re-elected in February last year.
New South Wales leader Morris Iemma described his WA counterpart's decision to quit as courageous, and said he had never displayed any indication that he was suffering from depression.
Prime Minister John Howard has also expressed his sorrow over the move.
"He worked very hard for the people of Western Australia as premier," said Mr Howard in a statement.
"Despite our political differences I always found it possible to work constructively with him."
A large portion of Australia's vast mineral resources is found in WA, and Dr Gallop leaves behind a booming state economy buoyed by high global demand for commodities like iron ore.
