The owner of Landmark Medical Center in Woonsocket has agreed to acquire three community hospitals in Maine.