I'm sure there's a lot of dogs that go without taking heartworm medicine and they do just fine without it.
Heartworms are contracted and spread by mosquitoes biting your dog.
If your dog doesn't get bit by mosquitoes then your dog will be fine but if you can try and remember to give them preventative heartworm medication to prevent the dog from getting infected with heartworms.
I wouldn't worry if you forgot to give your dog the heartworm medication. Nothing is really gonna happen.