How to conditionally book an appointment on calendar module? I would like to offer the opportunity for users of the site to book a visit to the doctor, do not let book if the day is full of appointments and show the day in red on the calendar.

Is this possible?
I'm not aware of any way to use the Calendar module for this. However, there are some distributions and/or contributed modules for managing such bookings. More details below.

Option 1: Distributions

The Clinic Appointment distribution is a brand new distribution for D7. Some more details about it (from its project page):


  It is a doctor appointment management system. It manages patient profile, doctors profile, and appointments. It supports multiple offices. It creates all kinds of reports that help clinic's day to day operation and business growth. It is a great choice for doctors to have an excellent management system built on a free open source software.
  
  Appointment Management System is the quickest way to get up and to run with patient appointment management. It includes the latest version of Drupal core, FullCalendar, and the other modules it is depending on. It lets you create a fully functioning appointment book, managing system out of the box. It comes with comprehensive reports powered by views module.
  
  Who should use Clinic Appointment? Anyone who want to build an appointment booking system. Anyone who wish to use it to schedule an appointment with doctor and patient. Customize patient, doctor content type by adding and deleting fields to the need for your business.


According to Comment nr 2 in issue # 2646628 it "Can be used for appointments made by patients" also. 

Option 2: Contributed modules

These modules have a stable release, and can be used  for either D6 or D7 (quotes are from their project pages):


Availability Calendars (D6 or D7).


  ... allows you to add an availability calendar to entities. Example use cases are tourist accommodation, e.g. bed and breakfast, holiday homes or self catered apartments, and car or motor bike rental.
  
  An availability calendar shows your customers at what dates your accommodation is still available and at what dates it is already booked.

Simple Reservation (D6 or D7).


  ... provides a simple and easy way to reserve items which can be created by the administrator. Examples for it's usage can be hotel rooms, boats, cars, airplanes, basically anything you can think of which can be reserved by one individual.
  
  The module provides the possibility to create reservations for other users (dependent on the permissions), and provides also restrictions in the maximum number of reservations a user can make and a maximum time a reservation can be made in advance.
  
  There is NO support for payment, booking and what ever one could imagine beyond the pure and simple reservation, and it is also NOT intended to create more than this simple functionality.

MERCI (D6 or D7).


  ... can extend any content type into a list of unique reservable items (like studios) or buckets of interchangeable items (like DV cameras). We followed the approach used by Organic Groups, Feed API, and Scheduler and added MERCI's configuration to the Edit tab of those content types.

Resource Conflict (D6 or D7).


  ... allows for users to book resources for use during events. For example, a student can book a microscope for use within their lab.



Booking Systems Comparison

Refer to Comparison of Booking System modules for a comparison of various modules related to bookings / reservations.

This comparison contains some other modules (not mentioned in my answer here) that might be worth considering also, e.g. in case of requirements that are slightly different (as compared to those in the question here).

Deciding which module to go for

When deciding between multiple modules, a typical consideration is often about the "maintenance status" of the various modules. To illustrate some of the criteria I often use for that, please checkout the community documentation about Maintenance Scorecards. Here is the intro about it (from that page):


  ... contains a list of 23 criteria (=28-5) that might help to evaluate
  the maintenance and support of contributed modules. Below is an
  attempt to apply those criteria to each of the native charting modules
  ...


Obvious, these scorecards are related to "charting modules", but the same criteria are applicable, IMHO, wheneven you need to decide between multiple modules.

Disclosure: I'm the author of that community documentation page (partially inspired by the 28 criteria in the issue linked near the beginning of the scorecards paragraph).