Medical hyperspectral imaging present a promising avenue for non-invasive diagnostic methods for diseases. Nonetheless, the sparsity of medical hyperspectral data within high-dimensional spaces introduces the “curse of dimensionality”, which diminishes the efficiency and accuracy of data processing efforts. Therefore, spectral dimensionality reduction emerges as an essential process in the analysis and utilization of MHSIs data. To retain the intrinsic properties of the spectral bands, an effective unsupervised band selection algorithm is proposed leveraging the gravitational search algorithm (GSA-UBS) to identify the optimal band subset. Taking into account the informational content and redundancy among candidate bands, a comprehensive evaluation criterion is established that incorporates a band distance matrix and an information entropy vector. Additionally, a straightforward discrete search strategy is developed that enables gravitational search algorithm to directly retrieve the original sequence numbers of the selected bands, bypassing the conventional 0–1 band weighting approach. The extensive evaluation of GSA-UBS on three publicly available invivo brain cancer MHSIs datasets and a remote sensing hyperspectral image demonstrates its superior performance compared to various state-of-the-art methods. The source code for GSA-UBS can be accessed at https://github.com/zhangchenglong1116/GSA_UBS.