If I don't get my H4 before my opt expires,do I have to leave for my home country after my visa expires?,

My f1 opt expires by November 2016. If I apply for h4 visa next week, will I get it by November, 2016? If not, will i have to leave for my home country immediately?

As long as you apply for H-4 COS and its pending, you can continue to stay and wait for its approval. You can do so for at most 240 days post current OPT expiration date or COS denial date (whichever is earlier).