Global climate change poses a major threat to crop growth and world food security. Plant biologists and breeders urgently need to improve the current germplasm and develop new varieties that can perform at high levels under stress conditions. Heat stress transcription factors (Hsfs) are the central part of plant heat shock response, which regulate a large number of functional genes to control HSR signaling and metabolic reactions. Using the genome sequence and gene chip data of Medicago truncatula, we screened the HSFs transcription factor gene family of Medicago truncatula, analyzed the HSFs gene structure, chromosomal location and phylogenetic relationship, and predicted the HSFs gene response to biotic and abiotic stresses. In addition, high-throughput sequencing of the leaf transcriptome of Medicago lupulina L. was carried out, and the HSFs gene sequences in the leaves of Medicago lupulina L. were analyzed. Our results showed that there were 23 HSF genes in the genome of Medicago truncatula, and these genes involved in the response to biological and abiotic stress of Medicago truncatula could not only improve the alfalfa, but also have great potential for crop improvement.