At the 2012 indoor Asian Championships, held in Hangzhou, China, on 19 February 2012, Barshim won the gold medal and established a new personal best (and national record) of 2.37 m (7'9.25"), breaking the previous championship record of 2.34: it was also the highest indoor jump in the world, to date in 2012. He began jumping at 2.10 and had first try clearances at 2.15, 2.20 and 2.24, before missing once at 2.28, temporarily falling to second place when Chinese jumper Zhang Guowei cleared on his first try. Zhang then failed at 2.31, while Barshim resumed his flawless jumping with first try clears at 2.31, 2.34 and 2.37. He then failed in three attempts at 2.40.
At the 2012 Olympic Games, held in London, United Kingdom, on 7 August, Barshim won the bronze medal with a jump of 2.29, finishing in a 3-way tie for third place with Derek Drouin from Canada and Robert Grabarz from Great Britain.
Barshim suffered a back injury in early 2012 and (later) said he was not healthy at the London Olympics. The problem was found to be a stress fracture in the fifth (L5) Lumbar vertebrae. In an interview for the IAAF in April 2013, Barshim said: "It started hurting bad before the (2012) World Indoor Championships and then I had to stop for a bit. Before the Olympics, I had to stop again, but we have a really good sports center in Doha and I also received treatment in Warsaw."