Render layers

When I render two objects separately at different layers (while the film is at "transparent) and then connect them in compositor I get two objects in one image which is good but there is no environment, no background image, I even tried making third layer which is empty and then connect it in compositor to other layers and still nothing, still those grey cubes are used as a background.

The film-transparent is set per scene, not per layer. Create a new scene just for the background and composite on top of that render.

NB. You can probably get away with rendering the background at a single sample.