Collisions with TileMaps work differently than other nodes.
A TileMap has a TileSet, for which you can create tiles with this technique: http://docs.godotengine.org/en/latest/tutorials/2d/using_tilemaps.html
During this process, collision shapes are added to tiles.
A TileMap doesn't need a StaticBody or CollisionShape, tiles should have them already.
Next, if you want your RayCast2D to collide with the TileMap, you have to ensure they share a collision layer. For example, by default layer 0 is checked on both, so they should collide.
Edit: also, don't forget to set enabled
to true.