He cautioned people against any kind of travel, saying they are playing with their health and also putting their families at risk.
Modi's appeal on Twitter came amid reports of migrants leaving for their homes from big cities, where several cases of coronavirus have been reported.
He said travelling in a crowded space increase the risk of its spread.
The risk will also increase for the people who live where you will be headed, he said.
"It is my plea to you to stay put for a few days in the city where you are. We can all stop this disease from spreading by doing so. By crowding railway stations and bus stands, we are playing with our health. Please be concerned about your health and that of your families. Don't step out of home if not necessary," the prime minister said.