The other BP-nominated director, Bob Dudley, BP's former chief executive, will also step down from Rosneft's board, the oil major said.
Helge Lund, BP's chair, described Russia's invasion of Ukraine as an "act of aggression which is having tragic consequences across the region".
He said BP had operated in Russia for more than 30 years, "working with brilliant Russian colleagues".
"However, this military action represents a fundamental change," he added. The board had concluded that the company's involvement with Rosneft "simply cannot continue", Lund added.
BP's move, which came as Norway's sovereign wealth fund said it was divesting of all of its Russian assets, will increase pressure on other oil and gas majors and commodity traders with investments in Russia, such as Shell, TotalEnergies, ExxonMobil, Trafigura and Vitol.
BP has previously been criticised for its 19.75 per cent stake in Rosneft, which has been under US and EU sanctions since Russia annexed Crimea in 2014. But the Russian invasion of Ukraine, which has resulted in sweeping sanctions against Putin's regime, has increased scrutiny of the partnership.
One UK asset manager with a large shareholding in BP described the move to offload the stake as a "good decision" and "inevitable".
BP said it would also exit three other joint ventures with Rosneft, potentially bringing an end to a lucrative, if often contentious, 30-year relationship between BP and Russia. BP's former joint venture with a consortium of oligarchs, TNK-BP, became so fraught in the 2000s that in 2008 Dudley, who then headed that business, was forced to flee the country.
BP sold its 50 per cent share in TNK-BP to Rosneft in 2013, for $12.5bn in cash and a fifth of the state-controlled oil company.
The Rosneft stake has been similarly profitable. Last year BP reported profits of more than $2.4bn from the shareholding and collected $640mn in dividends.
But as tanks, potentially fuelled with diesel from Rosneft — a main supplier to the Russian military — poured into Ukraine, the calculus for the UK oil major changed.
Looney said he had been "deeply shocked and saddened" by the offensive, which had "caused us to fundamentally rethink BP's position with Rosneft".
In a statement on Russia's state-owned news agency RIA Novosti, Rosneft said BP's decision "destroys a successful 30-year co-operation" and thanked the UK company for "decades of joint work".
BP's announcement came just days after Looney was summoned to a meeting with Kwasi Kwarteng, the UK business secretary, to discuss the company's involvement in Russia.
Kwarteng said on Sunday: "I welcome BP's decision to exit its shareholding in Rosneft oil company. Russia's unprovoked invasion of Ukraine must be a wake-up call for British businesses with commercial interests in Putin's Russia."
- Additional reporting Neil Hume and Jim Pickard in London
- Financial Times