Eggplant (Solanum melongena L.), which belongs to the Solanaceae family, is an important vegetable crop. However, its production is severely threatened by root-knot nematodes (RKNs) in many countries. Solanum torvum, a wild relative of eggplant, is employed worldwide as rootstock for eggplant cultivation due to its resistance to soil-borne diseases such as RKNs. In this study, to identify the RKN defense mechanisms, the transcriptomic profiles of eggplant and Solanum torvum were compared. A total of 5360 differentially expressed genes (DEGs) were identified for the response to RKN infection. Gene Ontology and Kyoto Encyclopedia of Genes and Genomes enrichment analysis showed that these DEGs are mainly involved in the processes of response to stimulus, protein phosphorylation, hormone signal transduction, and plant-pathogen interaction pathways. Many phytohormone-related genes and transcription factors (MYB, WRKY, and NAC) were differentially expressed at the four time points (ck, 7, 14, and 28 days post-infection). The abscisic acid signaling pathway might be involved in plant-nematode interactions. qRT-PCR validated the expression levels of some of the DEGs in eggplant. These findings demonstrate the nematode-induced expression profiles and provide some insights into the nematode resistance mechanism in eggplant.