From Madrid airport you can get a bus to Pamplona.
Spend a day or two there recovering from the time change and seeing the city
Then hop a bus directly to SJPP.
When the whole world of pilgrims are stopping in Pamplona on the way back through, you can either stop before or after and get "between the stages" so not in the bed rush.
Or do what Alex suggested and simply start walking from Pamplona.
The way via France is highly overrated in my opinion.
Then there is the bedbug issue they've been having and their planning for the Olympics.
Personally, I'd steer clear and go via Pamplona or from Madrid to SJPP.