"I am not in a position to say if it is a good or a bad thing to use ground forces" to intervene in the Syrian conflict, Rajoy said.
"What I do say is that the situation in Syria is the cause of a large part of the problems we are currently having in Europe," he added, speaking on COPE radio station.
"Settling the situation in Syria is of capital importance."
In the latest shocking sign of the migrants' plight, photographs of a small Syrian boy washed up dead on a Turkish beach made front pages around Europe on Thursday.
More From This Section
"The photograph is truly tragic. It is horrifying," Rajoy said. "And it is a sign of something that is happening often. Many women and children have died in the Mediterranean" while trying to reach Europe by sea.
Syrian leader Bashar al-Assad is battling various armed groups including the jihadist movement Islamic State.
Rajoy has faced demands for Spain to host a greater number of refugees, but he did not shift his position on Thursday.
He has said Spain, home to nearly 47 million people, is willing to receive 2,739 registered asylum seekers in 2015. He has implied his country might agree to take more but that any future quotas should take into account the country's high unemployment rate.
His political opponents in Spain ahead of December's general election have criticised his government's reaction to the migrant crisis.
"Europe has spent 1.208 billion euros on strengthening its borders and 700 million on helping refugees," Iglesias told radio station Cadena Ser on Thursday.
"Perhaps if we reversed those figures, if instead of spending money on putting up walls and barbed wire we spent it on helping people, things would get better.