Hand, foot, and mouth disease (HFMD) is widely spread in China Mainland, seriously threatening the health of infants and young children. We develop a meta‐population model that includes both local and ecdemic populations to study the impacts of fomites and immigration on the transmission of HFMD in Shanghai. The model includes both direct transmission between susceptible and infected individuals (asymptomatic or symptomatic) and indirect transmission via fomites. The forward bifurcation shows that if the basic reproduction number is less than unity, the epidemic will die out; otherwise, the epidemic will spread. The fitting results show that the basic reproduction numbers of the local population and the ecdemic population are 1.4696 and 1.7288, respectively. Sensitivity analysis of the basic reproduction number showed that there was a high correlation between the basic reproduction number and the transmission rate of asymptomatic infected individuals, as well as the parameters related to the fomites (such as indirect transmission rate and virus shedding rate). Hence, asymptomatic infected individuals and fomites have a significant impact on the new HFMD infection. The numerical simulations on the prevention and control strategy show that reducing the transmission rate between susceptible and asymptomatic infected individuals or reducing the fomites can delay the outbreak of the epidemic and weaken the severity of HFMD. Our findings can provide guidance for the eradication of HFMD epidemic in the presence of indirect transmission and other factors.