You can, but remember that canned pineapple tends to be more sweet and less firm than fresh. You'll get better overall texture with fresh, but pineapple isn't always in season or available - so in a pinch, you can absolutely substitute canned.