Geostrophic wind blows parallel to the isobars because the Coriolis force and pressure gradient force are in balance. However it should be realized that the actual wind is not always geostrophic -- especially near the surface.
As we move higher, surface features affect the wind less until the wind is indeed geostrophic. This level is considered the top of the boundary (or friction) layer. The height of the boundary layer can vary depending on the type of terrain, wind, and vertical temperature profile. The time of day and season of the year also affect the height of the boundary layer. However, usually the boundary layer exists from the surface to about 1-2 km above it.
In the friction layer, the turbulent friction that the Earth exerts on the air slows the wind down. This slowing causes the wind to be not geostrophic. As we look at the diagram above, this slowing down reduces the Coriolis force, and the pressure gradient force becomes more dominant. As a result, the total wind deflects slightly towards lower pressure. The amount of deflection the surface wind has with respect to the geostrophic wind above depends on the roughness of the terrain. Meteorologists call the difference between the total and geostrophic winds ageostrophic winds.