Barty was playing her first official match for nearly a year having chosen to stay at home in Australia when the tour resumed last summer following the coronavirus-related shutdown.
The 24-year-old is the top seed in the Yarra Valley Classic and she was a convincing 6-3 6-3 winner against Ana Bogdan in front of a surprisingly sparse crowd at Melbourne Park.
Barty said: "I think overall I felt pretty good. Ana did an exceptional job in making me play to a very high standard. I knew right from the first point I was going to have to be ready tonight and switched on straight away. That was really nice to have that challenge."
Australian Open champion Sofia Kenin had just won the first set 7-5 against Camila Giorgi when the Italian retired.
Osaka was playing her first match since lifting her third slam title in New York last September and eased past Alize Cornet 6-2 6-2 at the Gippsland Trophy.
The Japanese second seed said: "I was definitely really nervous going into it. But I'm really happy with how positive I was throughout the match."
In the third round Osaka will face Britain's Katie Boulter, who upset Coco Gauff 3-6 7-5 6-2.
French Open champion Iga Swiatek was playing her first match as a grand slam winner and made a nervous start against Kaja Juvan but recovered to win 2-6 6-2 6-1.