Yes it's recommended to give your dog heartworm medication year round to prevent heartworms.
Heartworms in dogs and cats are transmitted through mosquito bites. When mosquito activity is high your dog or cat will be more at risk for developing heartworms.