Many healthcare systems increasingly recognize the opportunities Electronic Health Records (EHRs) promise. However, EHR data sampled from different population groups can easily introduce unwanted biases, rarely permit individual-level data sharing, and make the data and fitted model hardly transferable across different population groups. In this paper, we propose a novel framework that leverages unbalanced optimal transport to facilitate the unsupervised transfer learning of EHRs between different population groups using a model trained in an embedded feature space. Upon deriving a theoretical bound, we find that the generalization error of our method is governed by the Wasserstein distance and unbalancedness between the source and target domains, as well as their labeling divergence, which can be used as a guide for binary classification and regression tasks. Our experiments, conducted on experimental datasets from MIMIC-III database, show that our transfer learning strategy significantly outperforms standard and machine learning transfer learning methods, with respect to accuracy and computational efficiency. Upon applying our framework to predict hospital duration for populations with different insurance plans, we finally find significant disparities across groups, suggesting our method as a potential tool to assess fairness in healthcare treatment.