There is a guarantee for getting an egg when the Pokémon are compatible. However breeding will only happen when the day care lady describes their relationship as “The two seem to get along”
Here, your Beldum and Ditto can't breed Since the day-care lady describes their relationship as "The two prefer to play with other Pokémon more than with each other.".
The day-care lady will say like this when the Pokémon are compatible but chances of finding an egg is a bit lower. Especially when they're from the same game. Briefly, you need to wait for some more for them getting along. I recommend you to catch another Beldum and try breed it with Ditto again or wait until they get along.
Thank you!
Source 60%