Does extending Master's graduation affect you while filing for H1-B?

I came to the US as a master’s student in Fall 2015. However,after spending two semesters at the university I decided to change my major and opted for a transfer to another university as a Fall 2016 student. I have taken due care regarding transferring my SEVIS from previous university to current one but I was only able to transfer 3 credits. This might extend my graduation to Dec 2017 (and not May 2017 as would have been the case without a transfer). Is this legal and will it affect me in the future during H1-B processing?

This has got nothing to do with your H1. It wont have any effect. You can study as many years as you can, that your University allows for a graduate course. Masters degree does not necessarily need to be finished in 2 years or as stated on the very first I-20.