“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.”
Millions of people have fled Syria to escape its civil war, according to the United Nations, swelling to hundreds of thousands the numbers of migrants arriving in Europe over recent months.
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.
“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.
“Islamic State controls a large part of the country,” Rajoy said. “The West cannot allow that for the dignity of the Syrian people.”
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.
The leader of the left-wing protest party Podemos, Pablo Iglesias, complained that Europe spent more on guarding its borders than on helping refugees.
“Europe has spent €1.208 billion 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.”