I recently got the same problem on my MacBook Pro 2012 running Mavericks.
I had recently upgraded to an SSD but also replaced the optical drive with a HDD. Replacing the optical drive is definately not as easy and requires unplugging a lot of peripherals one of which includes the bluetooth and Wi-Fi.
I thought that could be the problem so shut down the Mac, opened it up and checked all of the connections to the back of the new HDD enclosure which were fine. I then followed one of the cables (ribbons?) to the back right of the laptop (the one under the power button). Sure enough the connection there was loose. I made sure this was firmly back in place. Replaced the back. Booted her up and Wi-Fi is back.
I believe this may happen again because the black casing is not completely secure and missing a couple of screws, which with some use could cause the cable to come loose again. It also means my laptop speaker distorts at the highest volume I am guessing because it is not secure it is vibrating against the casing, so I need to get some more screws and properly fix this.
If these software fixes do not work then it is most likely a hardware issue.
If you can open up your Mac then have a look, if not as previously mentioned just try applying some pressure to the four corners with the Mac booted down. Failing that you will need to take it to the Apple Store.
Hope that helps.