The invention provides an online monitoring and early warning and real-time treatment system and method for heavy metal pollution in a farmland. The system comprises online heavy metal monitoring and early warning equipment, a real-time heavy metal treatment device, a heavy metal pollution monitoring platform and a control treatment unit. The field online monitoring and early warning and real-time heavy pollution treatment processes are combined, and the system has the characteristics of rapidness and simplicity in test, accurate result, low cost, low detection limit and high sensitivity, is not destructive on the sample, is capable of greatly shortening the detection period and is suitable for online field detection of the heavy metal content and real-time treatment of the heavy metal pollution. The requirements on professional skills of operators are reduced, and a technical target for integrally performing online monitoring and early warning and real-time treatment on the heavy metal pollution in the farmland is achieved. Moreover, according to the system, the concentration of a certain heavy metal in an area can be measured, the total heavy metal pollution degree in the area can also be measured, the testing sensitivity is high, and any heavy metal content can be simultaneously detected.