The 34-year-old Swiss, ranked third in the world, last played in January's Australian Open semi-final defeat by Novak Djokovic.
Federer suffered a torn knee cartilage the following day and underwent surgery in February.
He had been expected to return on clay in Monte Carlo next month but the Swiss will now make his comeback in Miami.
Federer won the Key Biscayne title in 2005 and 2006, and last played there in 2014 when he reached the quarter-finals.
Roger Federer will return to action following knee surgery earlier than expected at the Miami Open next week.