Here is what we know about Hogwarts Legacy and if it will have a multiplayer option to play with others online.
Hogwarts Legacy will be released globally on February 10th 2023, but players who have purchased the deluxe version will be able to get 72-hour early access starting from midnight on February 7th, 2023.

Players will experience life as a student at Hogwarts School of Witchcraft and Wizardry in the 1800s as they embark on a dangerous journey to uncover a hidden truth of the wizarding world. They will grow their magical abilities by mastering spells, brewing potions, taming magical beasts and more.
As it is set in the 1800s, this is before the time period of J.K. Rowling’s original stories. You will be playing as a fifth-year student and can customize the character at the onset of your adventure. As you progress, you’ll also be able to develop your own special combat style.
Is Hogwarts Legacy Multiplayer?
There were some rumors that stated that there would be multiplayer in Hogwarts Legacy, however it has been confirmed that this is not the case.
In various different FAQ’s for the game, it has been reiterated that it is a single-player game.
The first question asks if Hogwarts Legacy has an online or co-op play. The answer to which was no, neither of these are in the game.

Another asks if it is an original story to which the answer clearly states that is a single-player, action role-playing video game.

There are some games that have introduced multiplayer later on, so there is a possibility it could be added in the future, but it seems very unlikely that it will happen for Hogwarts Legacy!