This will depend on the housing association, but most will require you to complete a formal application process.
Each housing association must publish what is known as a ‘First Come, First Served Policy’ which will explain how they prioritise people when there is more than one potential purchaser for each home.