Roadside soils are regarded as a reservoir for heavy metal pollution, which potentially leads to ecosystem deterioration as well as serious hazard to human health. A comprehensive investigation was conducted for the levels, relationship with soil properties, and potential sources of heavy metals (Hg, Cu, Zn, Pb, Cd, and Cr) in roadside soils in six cities (Changzhi, Jincheng, Yuncheng, Linfen, Xinzhou, Datong) of Shanxi Province; and the corresponding ecological risk and human health risk associated with the concentrations of heavy metals were addressed. Heavy metal concentrations of 112 roadside soil samples in the surveyed cities were, in decreasing order, Zn, Cu, Cr, Pb, Cd, and Hg, which were higher than corresponding background values. The highest concentrations were in Changzhi. The results of Pearson correlation analysis demonstrated that positive correlations in varying degrees existed between soil properties such as electrical conductivity, total nitrogen, total phosphorus, and total organic carbon with specific heavy metals and that negative correlations were observed for clay and electrical conductivity. Anthropogenic sources related to traffic emissions and industrialization were the main sources of heavy metals in roadside soils according to principal component analysis. The ecological risk assessments were achieved by pollution index and potential risk index, indicating that contamination with Hg was the most serious, which posed the highest risk to the ecosystems in the surveyed cities; and the ecological risk in Changzhi ranked at the top compared with other cities. For the human health risk assessment, the results demonstrated that the noncarcinogenic and carcinogenic risks were in the acceptable range in the surveyed cities. However, there was a higher health risk from heavy metal exposure for children than adults, and the main exposure pathway was soil ingestion. In addition, Changzhi was the city with the highest noncarcinogenic and carcinogenic risks, and the main human health risks were posed by Cr contamination in roadside soil, which was different from the results of ecological risks. Both results of ecological and health risk assessment demonstrated that the higher risk exhibited in southern and southeastern cities than northern cities in Shanxi Province.