Championship leader Martin sets lap record to take pole at French Grand Prix
Martin went fastest with a time of 1:29.919 to become the first rider to go sub-90 seconds at Le Mans. His time was 0.192 seconds faster than Bagnaia and Aprilia's Maverick Vinales was third-quickest to complete the front row.
Both Martin and Bagnaia crashed when they attempted to set faster laps, while Aleix Espargaro and Jack Miller also ended up in the gravel as yellow flags came out and affected Enea Bastianini's chances of setting a faster time.
"It was a small crash, I got hit on the back but I'm ok," Martin said. "I feel we are fast enough to fight in the sprint."
Bastianini, third in the championship, will start 10th on the grid.
"I was fighting for pole position but I just lost (control of) the front on corner nine when I went over the white line," said Bagnaia, who is second in the championship and 17 points behind Martin.
"I'm in between two guys with really good pace."
VR46 Racing riders Fabio Di Giannantonio and Marco Bezzecchi will start fourth and fifth on the grid and Aleix Espargaro was sixth fastest.
Gresini Ducati's Marc Marquez could not advance to the second qualifying session after his last attempt to set a fast lap in Q1 was cancelled due to yellow flags on the circuit and the Spaniard will start 13th on the grid.