Ted bought the house in early 2010 after his mother got married to Clint. During the wedding, Ted was constantly reminded that he still hadn't found someone to settle down with. Trying to make things go forward, he purchased the house where he wants to settle down and raise his kids in.
Initially, the house is heavily in need of repairs, and the gang have fun tearing down some of the walls. While the gang all tell Ted he should sell the house, he ignores them and keeps it, showing Marshall all the different ideas he has for the house. (Home Wreckers)
The gang visit the house again a year later, and see all the changes Ted has made to the house. This is where they have the intervention for Barney, convincing him to visit his father (who lives ten minutes away). (Legendaddy)
In 2011, Ted decides to take the gang to his house to avoid Hurricane Irene, but they end up in Barney's apartment. Ted later finds out that an oak tree had crashed into the living room, during the hurricane. (Disaster Averted)
In 2013, Ted says he has finished the house's renovations and it looks exactly like the present house, minus the many decorations collected within. It took him four years to renovate it. This shows how the series is coming to an end and Ted is absolutely ready to settle down with a house to live in with his wife. When Lily comes to see the house she finds a "For Sale" sign. Ted tells her he intends to sell the house because he's moving to Chicago.(Something New)
Ted moved into the house when he decided not to move to Chicago when he met Tracy, the mother, at the Farhampton train station.
The house is seen in a flashforward to New Year's Day of 2022 in Rally, showing areas of the house that were unseen before, including the bedroom of Ted and the Mother, as well as a shot of the exterior of the house.
Since Ted and Robin ended up getting back together in 2030, it is reasonable to conclude that she moved into the house.