How do i connect two meshes together without ruining the topology
Try to reduce the edge loops' amount using diamond quads. They're very helpful for making the mesh less dense in certain parts. Also helps to create the proper edge flow defining the model's shape in some cases. In the example pictured below I reduced the 24 vertices loop to 12 vertices loop.


Diamond pattern- loop reduction from 3-1, 5-1 and 5-3 examples:




Another loops reduction method is pictured below.


Loops reduction from 4-2, 6-2 and 7-3:




Note: The complete answer to your problem is in the link @LukeD provided in his comment, but since I've done this topology presentation for my friend some time ago I decided not to waste my efforts and share it with you. Hope it'll be helpful :).