The emerging Omicron variant poses a serious threat to human health. Public transports play a critical role in infection spread. Based on the data of nearly 4 billion smartcard uses, between January 1, 2019 and January 31, 2021 from the Mass Transit Railway Corporation of Hong Kong, we analyzed the subway travel behavior of different population groups (adults, children, students and senior citizens) due to the COVID-19 pandemic and human travel behavior under different interventions (e.g. work suspension, school closure). Due to the pandemic, the number of MTR passengers (the daily number of passengers in close proximity in subway carriages) decreased by 37.4% (40.8%) for adults, 80.3% (78.5%) for children, 71.6% (71.6%) for students, and 33.5% (36.1%) for senior citizens. Due to work from home (school suspension), the number of contacted adults (students/children) in the same carriage during the rush hours decreased by 39.6% (38.6%/43.2%). If all workers, students, and children were encouraged to commute avoiding rush hours, the possible repeated contacts during rush hour of adults, children and students decreased by 73.3%, 77.9% and 79.5%, respectively. Since adults accounted for 87.3% of the total number of subway passengers during the pandemic, work from home and staggered shift pattern of workers can reduce the infection risk effectively. Our objective is to find the changes of local travel behavior due to the pandemic. From the perspective of public transports, the results provide a scientific support for COVID-19 prevention and control in cities.