Hepatocellular carcinoma (HCC) is the sixth most common cancer globally and the third leading cause of cancer-related mortality, primarily driven by viral infections (HCV, HBV) and steatotic liver diseases (SLD). Despite advances in treatment, early detection and accurate prognosis remain challenging. The Human leukocyte antigen G (HLA-G) molecule is dysregulated in various conditions, including cancers and viral infections. This study aimed to investigate HLA-G’s role in viral-related and SLD-driven HCC. We analyzed a cohort of 116 HCC patients and 140 healthy controls to assess HLA-G genetic variants and soluble levels. Results showed significantly higher levels of soluble HLA-G in HCC patients compared to controls (Pc = 0.003). Moreover, overall survival (OS) was significantly lower in patients with the extended HLA-G*01:01:01/UTR-1 haplotype (Log-rank test, p = 0.002), a trend consistent in both HCV and/or HBV-related HCC (p = 0.025) and SLD-related HCC (p = 0.018). Elevated sHLA-G levels were associated with shorter OS across both subgroups (p = 0.034 (HBV/HCV) and p = 0.010 (SLD), respectively). The findings suggest that elevated levels of soluble HLA-G and specific genetic variants are associated with poor prognosis in HCC patients, highlighting the potential of HLA-G as a prognostic biomarker in both viral-related and steatotic liver disease-related HCC